mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
refactor(redshift): align Redshift code with AGENTS.md style rules (#3992)
* refactor(redshift): align main sources with AGENTS.md style rules Import Matcher instead of qualifying it inline, replace a var with its explicit type, and order the RedshiftService imports (java.* last). Remove em-dashes from comments and a log message. Two swallowed IOExceptions now log with context (snapshot dump deletion and exec output capture), and the remaining intentionally ignored one says why it is safe. * refactor(redshift): replace var and inline qualified names in tests Use explicit types instead of var and import the classes that were written fully qualified inline, as AGENTS.md requires. * refactor(redshift): drop the test prefix from test method names AGENTS.md prefers camelCase sentences over testX names, which are common in older tests but not the pattern to copy. Rename the 99 remaining testX methods in the Redshift tests. No assertions changed. * refactor(redshift): remove remaining em-dashes from test comments * refactor(redshift): log warning when temp dump cleanup fails on aborted reboot
This commit is contained in:
1 parent
fc81cdedd9
commit
5f1f80b496
14 files changed
+177
-165
No files matched your search
+2
-2
@@ -75,7 +75,7 @@ class RedshiftCatalogSeedIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCatalogViewsIntrospection() throws Exception {
|
||||
void catalogViewsIntrospection() throws Exception {
|
||||
clusterId = "cat-seed-" + UUID.randomUUID().toString().substring(0, 8);
|
||||
Cluster cluster = service.createCluster(clusterId, "dc2.large", "admin", "Secret123");
|
||||
|
||||
@@ -250,7 +250,7 @@ class RedshiftCatalogSeedIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAllDocumentedRedshiftColumnsContract() throws Exception {
|
||||
void allDocumentedRedshiftColumnsContract() throws Exception {
|
||||
clusterId = "cat-contract-" + UUID.randomUUID().toString().substring(0, 8);
|
||||
Cluster cluster = service.createCluster(clusterId, "dc2.large", "admin", "Secret123");
|
||||
|
||||
|
||||
+5
-5
@@ -49,7 +49,7 @@ public class RedshiftOperationsTest {
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void testParameterGroupLifecycle() {
|
||||
void parameterGroupLifecycle() {
|
||||
// 1. CreateClusterParameterGroup
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
@@ -125,7 +125,7 @@ public class RedshiftOperationsTest {
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
void testClusterAndSnapshotLifecycle() {
|
||||
void clusterAndSnapshotLifecycle() {
|
||||
when(containerManager.start(any(), eq("cluster-src"), any(), any()))
|
||||
.thenReturn(new RedshiftContainerHandle("c1", "cluster-src", "localhost", 5439));
|
||||
doAnswer(invocation -> {
|
||||
@@ -155,7 +155,7 @@ public class RedshiftOperationsTest {
|
||||
.body(containsString("<ClusterAvailabilityStatus>Available</ClusterAvailabilityStatus>"))
|
||||
.body(containsString("<AvailabilityZoneRelocationStatus>disabled</AvailabilityZoneRelocationStatus>"));
|
||||
|
||||
// 1b. RebootCluster — must preserve data (no Docker volume backs this container)
|
||||
// 1b. RebootCluster: must preserve data (no Docker volume backs this container)
|
||||
when(containerManager.getContainer(any(), eq("cluster-src")))
|
||||
.thenReturn(Optional.of(new RedshiftContainerHandle("c1", "cluster-src", "localhost", 5439)));
|
||||
given()
|
||||
@@ -320,7 +320,7 @@ public class RedshiftOperationsTest {
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
void testClusterSubnetGroupLifecycle() {
|
||||
void clusterSubnetGroupLifecycle() {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
@@ -636,7 +636,7 @@ public class RedshiftOperationsTest {
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
void testTagLifecycle() {
|
||||
void tagLifecycle() {
|
||||
when(containerManager.start(any(), eq("cluster-tags"), any(), any()))
|
||||
.thenReturn(new RedshiftContainerHandle("c3", "cluster-tags", "localhost", 5441));
|
||||
|
||||
|
||||
+32
-32
@@ -60,7 +60,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterAction() {
|
||||
void createClusterAction() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
params.putSingle("NodeType", "dc2.large");
|
||||
@@ -135,7 +135,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusters() {
|
||||
void describeClusters() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
|
||||
@@ -151,7 +151,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClustersIncludesAvailabilityStatuses() {
|
||||
void describeClustersIncludesAvailabilityStatuses() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
|
||||
@@ -167,7 +167,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testClusterAvailabilityStatusMapsTransientStatesToModifying() {
|
||||
void clusterAvailabilityStatusMapsTransientStatesToModifying() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
|
||||
@@ -182,7 +182,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testClusterAvailabilityStatusMapsFailed() {
|
||||
void clusterAvailabilityStatusMapsFailed() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
|
||||
@@ -197,7 +197,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteCluster() {
|
||||
void deleteCluster() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
|
||||
@@ -214,7 +214,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterSnapshot() {
|
||||
void createClusterSnapshot() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("SnapshotIdentifier", "test-snapshot");
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
@@ -238,7 +238,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusterSnapshots() {
|
||||
void describeClusterSnapshots() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("SnapshotIdentifier", "test-snapshot");
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
@@ -260,7 +260,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteClusterSnapshot() {
|
||||
void deleteClusterSnapshot() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("SnapshotIdentifier", "test-snapshot");
|
||||
|
||||
@@ -275,7 +275,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshot() {
|
||||
void restoreFromClusterSnapshot() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "restored-cluster");
|
||||
params.putSingle("SnapshotIdentifier", "test-snapshot");
|
||||
@@ -299,7 +299,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotBySnapshotArn() {
|
||||
void restoreFromClusterSnapshotBySnapshotArn() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "restored-cluster");
|
||||
params.putSingle("SnapshotArn", "arn:aws:redshift:us-east-1:acc:snapshot:src/my-snap");
|
||||
@@ -312,7 +312,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotMalformedArnIs400() {
|
||||
void restoreFromClusterSnapshotMalformedArnIs400() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "restored-cluster");
|
||||
params.putSingle("SnapshotArn", "not-an-arn");
|
||||
@@ -324,7 +324,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotWithoutSnapshotIs400() {
|
||||
void restoreFromClusterSnapshotWithoutSnapshotIs400() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "restored-cluster");
|
||||
|
||||
@@ -334,7 +334,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotForeignAccountArnNotFound() {
|
||||
void restoreFromClusterSnapshotForeignAccountArnNotFound() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "restored-cluster");
|
||||
params.putSingle("SnapshotArn", "arn:aws:redshift:us-east-1:999999999999:snapshot:src/my-snap");
|
||||
@@ -346,7 +346,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testClusterXmlCarriesDefaultParameterGroupAndMultiAZ() {
|
||||
void clusterXmlCarriesDefaultParameterGroupAndMultiAZ() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "c1");
|
||||
when(service.describeClusters("c1")).thenReturn(List.of(availableCluster("c1")));
|
||||
@@ -357,7 +357,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterParameterGroup() {
|
||||
void createClusterParameterGroup() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ParameterGroupName", "test-pg");
|
||||
params.putSingle("ParameterGroupFamily", "redshift-1.0");
|
||||
@@ -375,7 +375,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusterParameterGroups() {
|
||||
void describeClusterParameterGroups() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ParameterGroupName", "test-pg");
|
||||
|
||||
@@ -391,7 +391,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusterParameters() {
|
||||
void describeClusterParameters() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ParameterGroupName", "test-pg");
|
||||
|
||||
@@ -406,7 +406,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteClusterParameterGroup() {
|
||||
void deleteClusterParameterGroup() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ParameterGroupName", "test-pg");
|
||||
|
||||
@@ -420,7 +420,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateTagsAcceptsNamedMemberForm() {
|
||||
void createTagsAcceptsNamedMemberForm() {
|
||||
// Real Redshift SDK sends "Tags.Tag.N.Key/.Value", không phải "Tags.member.N...".
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ResourceName", "arn:aws:redshift:us-east-1:000000000000:cluster:test-cluster");
|
||||
@@ -437,7 +437,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterSubnetGroupAcceptsNamedMemberForm() {
|
||||
void createClusterSubnetGroupAcceptsNamedMemberForm() {
|
||||
// Real Redshift SDK sends "SubnetIds.SubnetIdentifier.N", không phải "SubnetIds.member.N".
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterSubnetGroupName", "test-sng");
|
||||
@@ -458,7 +458,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterParameterGroupAcceptsNamedMemberForm() {
|
||||
void modifyClusterParameterGroupAcceptsNamedMemberForm() {
|
||||
// Real Redshift SDK sends "Parameters.Parameter.N.ParameterName/.ParameterValue".
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ParameterGroupName", "test-pg");
|
||||
@@ -477,7 +477,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterSubnetGroupRequiresName() {
|
||||
void createClusterSubnetGroupRequiresName() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("Description", "desc");
|
||||
|
||||
@@ -488,7 +488,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterRequiresClusterIdentifier() {
|
||||
void modifyClusterRequiresClusterIdentifier() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("NodeType", "dc2.large");
|
||||
|
||||
@@ -622,7 +622,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeLoggingStatus() {
|
||||
void describeLoggingStatus() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
|
||||
@@ -637,7 +637,7 @@ class RedshiftQueryHandlerTest {
|
||||
assertEquals(200, response.getStatus());
|
||||
String xml = (String) response.getEntity();
|
||||
// The real AWS wire format wraps the fields in a *Result element matching the
|
||||
// operation name — verified against the SDK's own deserializer, not guessed.
|
||||
// operation name, verified against the SDK's own deserializer, not guessed.
|
||||
assertTrue(xml.contains("<DescribeLoggingStatusResult>"));
|
||||
assertTrue(xml.contains("<LoggingEnabled>true</LoggingEnabled>"));
|
||||
assertTrue(xml.contains("<BucketName>my-bucket</BucketName>"));
|
||||
@@ -645,7 +645,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeLoggingStatusRequiresClusterIdentifier() {
|
||||
void describeLoggingStatusRequiresClusterIdentifier() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
|
||||
AwsException ex = assertThrows(
|
||||
@@ -655,7 +655,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEnableLogging() {
|
||||
void enableLogging() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
params.putSingle("BucketName", "my-bucket");
|
||||
@@ -676,7 +676,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDisableLogging() {
|
||||
void disableLogging() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
|
||||
@@ -798,7 +798,7 @@ class RedshiftQueryHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBuildClusterXmlIncludesParameterGroupAndTags() {
|
||||
void buildClusterXmlIncludesParameterGroupAndTags() {
|
||||
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
|
||||
params.putSingle("ClusterIdentifier", "test-cluster");
|
||||
|
||||
@@ -871,8 +871,8 @@ class RedshiftQueryHandlerTest {
|
||||
|
||||
handler.handle("GetClusterCredentials", params);
|
||||
|
||||
java.time.Instant expiresAt = credentialBroker.resolve("acc", "c1", "IAM:analyst").orElseThrow().expiresAt();
|
||||
assertTrue(expiresAt.isAfter(java.time.Instant.now().plusSeconds(800)),
|
||||
Instant expiresAt = credentialBroker.resolve("acc", "c1", "IAM:analyst").orElseThrow().expiresAt();
|
||||
assertTrue(expiresAt.isAfter(Instant.now().plusSeconds(800)),
|
||||
"an out-of-range config default must fall back to the AWS minimum, not be used as-is");
|
||||
}
|
||||
|
||||
|
||||
+70
-69
@@ -37,6 +37,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
@@ -159,7 +160,7 @@ class RedshiftServiceTest {
|
||||
ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class);
|
||||
verify(integrationBackend).put(keyCaptor.capture(), eq(integration));
|
||||
String storageKey = keyCaptor.getValue();
|
||||
when(integrationBackend.keysForAccount("111111111111")).thenReturn(java.util.Set.of(storageKey));
|
||||
when(integrationBackend.keysForAccount("111111111111")).thenReturn(Set.of(storageKey));
|
||||
when(integrationBackend.getForAccount("111111111111", storageKey)).thenReturn(Optional.of(integration));
|
||||
|
||||
service.updateIntegrationBackfillProgress("111111111111", integration.getIntegrationArn(),
|
||||
@@ -176,7 +177,7 @@ class RedshiftServiceTest {
|
||||
|
||||
@Test
|
||||
void updateIntegrationBackfillProgressOnUnknownIntegrationThrows() {
|
||||
when(integrationBackend.keysForAccount("111111111111")).thenReturn(java.util.Set.of());
|
||||
when(integrationBackend.keysForAccount("111111111111")).thenReturn(Set.of());
|
||||
|
||||
assertThrows(AwsException.class, () -> service.updateIntegrationBackfillProgress(
|
||||
"111111111111", "arn:aws:redshift:us-east-1:111111111111:integration:missing", null, true));
|
||||
@@ -237,7 +238,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testOnStartRecreatesContainersAcrossAccounts() {
|
||||
void onStartRecreatesContainersAcrossAccounts() {
|
||||
Cluster clusterA = new Cluster();
|
||||
clusterA.setClusterIdentifier("cluster-a");
|
||||
clusterA.setMasterUsername("admin");
|
||||
@@ -270,7 +271,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testOnStartSkipsClusterWithRunningContainer() {
|
||||
void onStartSkipsClusterWithRunningContainer() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("cluster-a");
|
||||
cluster.setClusterStatus("available");
|
||||
@@ -286,7 +287,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testOnStartMarksClusterUnavailableOnStartFailure() {
|
||||
void onStartMarksClusterUnavailableOnStartFailure() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("cluster-a");
|
||||
cluster.setMasterUsername("admin");
|
||||
@@ -314,7 +315,7 @@ class RedshiftServiceTest {
|
||||
persisted.setClusterStatus("available");
|
||||
persisted.setProxyPort(7108);
|
||||
|
||||
var entry = mock(AccountAwareStorageBackend.AccountEntry.class);
|
||||
AccountAwareStorageBackend.AccountEntry<Cluster> entry = mock(AccountAwareStorageBackend.AccountEntry.class);
|
||||
when(entry.value()).thenReturn(persisted);
|
||||
when(entry.accountId()).thenReturn("111111111111");
|
||||
when(entry.key()).thenReturn("c1");
|
||||
@@ -333,7 +334,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateCluster() {
|
||||
void createCluster() {
|
||||
when(clusterBackend.get(anyString())).thenReturn(Optional.empty());
|
||||
when(cm.start(any(), any(), any(), any())).thenReturn(new RedshiftContainerHandle("c1", "my-cluster", "localhost", 5432));
|
||||
|
||||
@@ -346,7 +347,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterWithVpcMetadata() {
|
||||
void createClusterWithVpcMetadata() {
|
||||
when(clusterBackend.get(anyString())).thenReturn(Optional.empty());
|
||||
when(cm.start(any(), any(), any(), any())).thenReturn(new RedshiftContainerHandle("c1", "my-cluster", "localhost", 5432));
|
||||
|
||||
@@ -381,7 +382,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterAlreadyExists() {
|
||||
void createClusterAlreadyExists() {
|
||||
when(clusterBackend.get("existing-cluster")).thenReturn(Optional.of(new Cluster()));
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -474,7 +475,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusters() {
|
||||
void describeClusters() {
|
||||
Cluster c = new Cluster();
|
||||
c.setClusterIdentifier("test-c");
|
||||
when(clusterBackend.get("test-c")).thenReturn(Optional.of(c));
|
||||
@@ -498,7 +499,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteCluster() {
|
||||
void deleteCluster() {
|
||||
Cluster c = new Cluster();
|
||||
c.setClusterIdentifier("test-c");
|
||||
when(clusterBackend.get("test-c")).thenReturn(Optional.of(c));
|
||||
@@ -557,7 +558,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRebootClusterDumpsAndRestoresData() throws Exception {
|
||||
void rebootClusterDumpsAndRestoresData() throws Exception {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
cluster.setMasterUsername("admin");
|
||||
@@ -610,7 +611,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRebootClusterNotFound() {
|
||||
void rebootClusterNotFound() {
|
||||
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () -> service.rebootCluster("missing"));
|
||||
@@ -634,8 +635,8 @@ class RedshiftServiceTest {
|
||||
assertThrows(AwsException.class, () -> service.rebootCluster("c1"));
|
||||
|
||||
// The proxy started during the reboot must be stopped again on failure, and the
|
||||
// replacement container must be stopped too — once before the restart, once in
|
||||
// rollback — so it is not left running behind a "failed" cluster.
|
||||
// replacement container must be stopped too, once before the restart, once in
|
||||
// rollback, so it is not left running behind a "failed" cluster.
|
||||
verify(proxyManager).startProxy(eq("111111111111:c1"), eq(7107), any(), anyInt(),
|
||||
any(), any(), any(), any(), any(), any());
|
||||
verify(proxyManager, times(2)).stopProxy("111111111111:c1");
|
||||
@@ -675,7 +676,7 @@ class RedshiftServiceTest {
|
||||
assertThrows(AwsException.class, () -> service.rebootCluster("c1"));
|
||||
|
||||
// start() can create the container before throwing (readiness check); the
|
||||
// original is already gone, so rollback removes anything under the name —
|
||||
// original is already gone, so rollback removes anything under the name:
|
||||
// once for the original teardown, once for the possible orphan.
|
||||
verify(cm, times(2)).stop("111111111111", "c1");
|
||||
|
||||
@@ -705,7 +706,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateSnapshot() {
|
||||
void createSnapshot() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
cluster.setMasterUsername("admin");
|
||||
@@ -737,7 +738,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateSnapshotClusterNotFound() {
|
||||
void createSnapshotClusterNotFound() {
|
||||
when(clusterBackend.get("missing-cluster")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -745,7 +746,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateSnapshotAlreadyExists() {
|
||||
void createSnapshotAlreadyExists() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
|
||||
@@ -756,7 +757,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateSnapshotRejectsTraversalOrMalformedIdentifier() {
|
||||
void createSnapshotRejectsTraversalOrMalformedIdentifier() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
cluster.setMasterUsername("admin");
|
||||
@@ -778,7 +779,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterUpdatesMetadataAndPassword() {
|
||||
void modifyClusterUpdatesMetadataAndPassword() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
cluster.setNodeType("dc2.large");
|
||||
@@ -796,7 +797,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterUpdatesVpcSecurityGroups() {
|
||||
void modifyClusterUpdatesVpcSecurityGroups() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
cluster.setMasterUsername("admin");
|
||||
@@ -810,7 +811,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterNotFound() {
|
||||
void modifyClusterNotFound() {
|
||||
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -837,7 +838,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeLoggingStatusDefaultsToDisabled() {
|
||||
void describeLoggingStatusDefaultsToDisabled() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
|
||||
@@ -849,14 +850,14 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeLoggingStatusNotFound() {
|
||||
void describeLoggingStatusNotFound() {
|
||||
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () -> service.describeLoggingStatus("missing"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEnableLogging() {
|
||||
void enableLogging() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
|
||||
@@ -908,7 +909,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEnableLoggingRequiresBucketName() {
|
||||
void enableLoggingRequiresBucketName() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
|
||||
@@ -917,7 +918,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEnableLoggingCloudWatchDoesNotRequireBucketName() {
|
||||
void enableLoggingCloudWatchDoesNotRequireBucketName() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
|
||||
@@ -929,7 +930,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterAssignsDefaultParameterGroup() {
|
||||
void createClusterAssignsDefaultParameterGroup() {
|
||||
when(clusterBackend.get(anyString())).thenReturn(Optional.empty());
|
||||
when(cm.start(any(), any(), any(), any())).thenReturn(new RedshiftContainerHandle("c1", "my-cluster", "localhost", 5432));
|
||||
|
||||
@@ -938,7 +939,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterStoresMultiAZ() {
|
||||
void modifyClusterStoresMultiAZ() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
|
||||
@@ -947,7 +948,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeDefaultParameterGroupIsSynthesized() {
|
||||
void describeDefaultParameterGroupIsSynthesized() {
|
||||
when(parameterGroupBackend.get("default.redshift-1.0")).thenReturn(Optional.empty());
|
||||
|
||||
List<ClusterParameterGroup> groups = service.describeClusterParameterGroups("default.redshift-1.0");
|
||||
@@ -956,14 +957,14 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEnableLoggingNotFound() {
|
||||
void enableLoggingNotFound() {
|
||||
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () -> service.enableLogging("missing", "my-bucket", null, null, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDisableLoggingClearsConfig() {
|
||||
void disableLoggingClearsConfig() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
cluster.setLoggingEnabled(true);
|
||||
@@ -981,14 +982,14 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDisableLoggingNotFound() {
|
||||
void disableLoggingNotFound() {
|
||||
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () -> service.disableLogging("missing"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeSnapshots() {
|
||||
void describeSnapshots() {
|
||||
Snapshot s = new Snapshot("snap-1", "my-cluster", "available", 5439, "admin");
|
||||
when(snapshotBackend.get("snap-1")).thenReturn(Optional.of(s));
|
||||
|
||||
@@ -998,14 +999,14 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeSnapshotsNotFound() {
|
||||
void describeSnapshotsNotFound() {
|
||||
when(snapshotBackend.get("missing-snap")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () -> service.describeSnapshots("missing-snap"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteSnapshot() {
|
||||
void deleteSnapshot() {
|
||||
Snapshot s = new Snapshot("snap-1", "my-cluster", "available", 5439, "admin");
|
||||
s.setSqlDump(dumpPath("snap-1"));
|
||||
when(snapshotBackend.get("snap-1")).thenReturn(Optional.of(s));
|
||||
@@ -1018,14 +1019,14 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteSnapshotNotFound() {
|
||||
void deleteSnapshotNotFound() {
|
||||
when(snapshotBackend.get("missing-snap")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () -> service.deleteSnapshot("missing-snap"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshot() {
|
||||
void restoreFromClusterSnapshot() {
|
||||
Cluster sourceCluster = new Cluster();
|
||||
sourceCluster.setClusterIdentifier("source-cluster");
|
||||
sourceCluster.setMasterPassword("password123");
|
||||
@@ -1056,7 +1057,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotUsesStoredPasswordAfterSourceClusterDeleted() {
|
||||
void restoreFromClusterSnapshotUsesStoredPasswordAfterSourceClusterDeleted() {
|
||||
Snapshot snapshot = new Snapshot("my-snapshot", "deleted-source", "available", 5439, "admin");
|
||||
snapshot.setMasterPassword("original-secret");
|
||||
snapshot.setSqlDump(dumpPath("my-snapshot"));
|
||||
@@ -1074,7 +1075,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotFallsBackToAdminWhenSourceClusterGone() {
|
||||
void restoreFromClusterSnapshotFallsBackToAdminWhenSourceClusterGone() {
|
||||
Snapshot snapshot = new Snapshot("my-snapshot", "deleted-source", "available", 5439, "admin");
|
||||
snapshot.setSqlDump(dumpPath("my-snapshot"));
|
||||
when(clusterBackend.get("restored-cluster")).thenReturn(Optional.empty());
|
||||
@@ -1090,7 +1091,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotAlreadyExists() {
|
||||
void restoreFromClusterSnapshotAlreadyExists() {
|
||||
when(clusterBackend.get("existing-cluster")).thenReturn(Optional.of(new Cluster()));
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -1098,7 +1099,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotNotFound() {
|
||||
void restoreFromClusterSnapshotNotFound() {
|
||||
when(clusterBackend.get("new-cluster")).thenReturn(Optional.empty());
|
||||
when(snapshotBackend.get("missing-snapshot")).thenReturn(Optional.empty());
|
||||
|
||||
@@ -1107,7 +1108,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotFailure() {
|
||||
void restoreFromClusterSnapshotFailure() {
|
||||
Snapshot snapshot = new Snapshot("my-snapshot", "source-cluster", "available", 5439, "admin", dumpPath("my-snapshot"));
|
||||
when(clusterBackend.get("failed-cluster")).thenReturn(Optional.empty());
|
||||
when(snapshotBackend.get("my-snapshot")).thenReturn(Optional.of(snapshot));
|
||||
@@ -1118,9 +1119,9 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreFromClusterSnapshotRejectsUntrustedDumpPathBeforeProvisioning() {
|
||||
void restoreFromClusterSnapshotRejectsUntrustedDumpPathBeforeProvisioning() {
|
||||
// A dump path persisted outside the account dir (e.g. by pre-validation code) must be
|
||||
// rejected up front — no cluster record, no container.
|
||||
// rejected up front: no cluster record, no container.
|
||||
Snapshot snapshot = new Snapshot("my-snapshot", "source-cluster", "available", 5439, "admin", "/etc/shadow");
|
||||
when(clusterBackend.get("restored-cluster")).thenReturn(Optional.empty());
|
||||
when(snapshotBackend.get("my-snapshot")).thenReturn(Optional.of(snapshot));
|
||||
@@ -1187,7 +1188,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterParameterGroup() {
|
||||
void createClusterParameterGroup() {
|
||||
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.empty());
|
||||
|
||||
ClusterParameterGroup pg = service.createClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
|
||||
@@ -1200,7 +1201,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterParameterGroupAlreadyExists() {
|
||||
void createClusterParameterGroupAlreadyExists() {
|
||||
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(new ClusterParameterGroup()));
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -1208,7 +1209,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusterParameterGroups() {
|
||||
void describeClusterParameterGroups() {
|
||||
ClusterParameterGroup pg = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
|
||||
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(pg));
|
||||
|
||||
@@ -1218,7 +1219,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusterParameterGroupsNotFound() {
|
||||
void describeClusterParameterGroupsNotFound() {
|
||||
when(parameterGroupBackend.get("missing-pg")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -1226,7 +1227,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteClusterParameterGroup() {
|
||||
void deleteClusterParameterGroup() {
|
||||
ClusterParameterGroup pg = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
|
||||
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(pg));
|
||||
|
||||
@@ -1238,7 +1239,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteClusterParameterGroupNotFound() {
|
||||
void deleteClusterParameterGroupNotFound() {
|
||||
when(parameterGroupBackend.get("missing-pg")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -1246,7 +1247,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterParameterGroup() {
|
||||
void modifyClusterParameterGroup() {
|
||||
ClusterParameterGroup group = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
|
||||
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(group));
|
||||
|
||||
@@ -1261,7 +1262,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterParameterGroupAppendsUnknownParameter() {
|
||||
void modifyClusterParameterGroupAppendsUnknownParameter() {
|
||||
ClusterParameterGroup group = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
|
||||
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(group));
|
||||
|
||||
@@ -1273,7 +1274,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterParameterGroupNotFound() {
|
||||
void modifyClusterParameterGroupNotFound() {
|
||||
when(parameterGroupBackend.get("missing")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -1281,7 +1282,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusterParametersReturnsStoredValues() {
|
||||
void describeClusterParametersReturnsStoredValues() {
|
||||
ClusterParameterGroup group = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
|
||||
group.setParameters(new ArrayList<>(List.of(new Parameter("statement_timeout", "5000"))));
|
||||
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(group));
|
||||
@@ -1294,7 +1295,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterParameterGroupPreservesMetadata() {
|
||||
void modifyClusterParameterGroupPreservesMetadata() {
|
||||
ClusterParameterGroup group = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
|
||||
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(group));
|
||||
|
||||
@@ -1311,7 +1312,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateAndListTagsForCluster() {
|
||||
void createAndListTagsForCluster() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
|
||||
@@ -1324,7 +1325,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteTagsForCluster() {
|
||||
void deleteTagsForCluster() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
cluster.setTags(new LinkedHashMap<>(Map.of("env", "test", "team", "data")));
|
||||
@@ -1336,19 +1337,19 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateTagsRejectsNonArnResourceName() {
|
||||
void createTagsRejectsNonArnResourceName() {
|
||||
assertThrows(AwsException.class, () ->
|
||||
service.createTags("my-cluster", Map.of("env", "test")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateTagsRejectsUnknownResourceType() {
|
||||
void createTagsRejectsUnknownResourceType() {
|
||||
assertThrows(AwsException.class, () ->
|
||||
service.createTags("arn:aws:redshift:us-east-1:111111111111:reservednode:foo", Map.of("env", "test")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeTagsForSpecificResource() {
|
||||
void describeTagsForSpecificResource() {
|
||||
Cluster cluster = new Cluster();
|
||||
cluster.setClusterIdentifier("my-cluster");
|
||||
cluster.setTags(new LinkedHashMap<>(Map.of("env", "test")));
|
||||
@@ -1364,7 +1365,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeTagsScansAllResourcesOfType() {
|
||||
void describeTagsScansAllResourcesOfType() {
|
||||
Cluster a = new Cluster();
|
||||
a.setClusterIdentifier("cluster-a");
|
||||
a.setTags(new LinkedHashMap<>(Map.of("env", "prod")));
|
||||
@@ -1383,7 +1384,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterSubnetGroup() {
|
||||
void createClusterSubnetGroup() {
|
||||
when(subnetGroupBackend.get("my-subnet-group")).thenReturn(Optional.empty());
|
||||
|
||||
ClusterSubnetGroup group = service.createClusterSubnetGroup(
|
||||
@@ -1396,7 +1397,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateClusterSubnetGroupAlreadyExists() {
|
||||
void createClusterSubnetGroupAlreadyExists() {
|
||||
when(subnetGroupBackend.get("existing")).thenReturn(Optional.of(new ClusterSubnetGroup()));
|
||||
|
||||
assertThrows(AwsException.class, () ->
|
||||
@@ -1404,7 +1405,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeClusterSubnetGroups() {
|
||||
void describeClusterSubnetGroups() {
|
||||
ClusterSubnetGroup group = new ClusterSubnetGroup("my-group", "d", "vpc-1", List.of("subnet-1"));
|
||||
when(subnetGroupBackend.get("my-group")).thenReturn(Optional.of(group));
|
||||
|
||||
@@ -1415,7 +1416,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testModifyClusterSubnetGroup() {
|
||||
void modifyClusterSubnetGroup() {
|
||||
ClusterSubnetGroup group = new ClusterSubnetGroup("my-group", "old", "vpc-1", List.of("subnet-1"));
|
||||
when(subnetGroupBackend.get("my-group")).thenReturn(Optional.of(group));
|
||||
|
||||
@@ -1426,7 +1427,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteClusterSubnetGroup() {
|
||||
void deleteClusterSubnetGroup() {
|
||||
ClusterSubnetGroup group = new ClusterSubnetGroup("my-group", "d", "vpc-1", List.of("subnet-1"));
|
||||
when(subnetGroupBackend.get("my-group")).thenReturn(Optional.of(group));
|
||||
|
||||
@@ -1438,7 +1439,7 @@ class RedshiftServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteClusterSubnetGroupNotFound() {
|
||||
void deleteClusterSubnetGroupNotFound() {
|
||||
when(subnetGroupBackend.get("missing")).thenReturn(Optional.empty());
|
||||
|
||||
assertThrows(AwsException.class, () -> service.deleteClusterSubnetGroup("missing"));
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
class RedshiftCatalogResourceTest {
|
||||
|
||||
@Test
|
||||
void testBootstrapCatalogResourceExistsAndContainsExpectedViews() throws Exception {
|
||||
void bootstrapCatalogResourceExistsAndContainsExpectedViews() throws Exception {
|
||||
try (InputStream in = getClass().getResourceAsStream("/redshift/bootstrap-catalog.sql")) {
|
||||
assertNotNull(in, "bootstrap-catalog.sql must exist on classpath");
|
||||
String sql = new String(in.readAllBytes(), StandardCharsets.UTF_8);
|
||||
|
||||
+22
-22
@@ -110,7 +110,7 @@ class RedshiftContainerManagerTest {
|
||||
private static final String ACCOUNT_ID = "111111111111";
|
||||
|
||||
@Test
|
||||
void testTakeSnapshotContainerNotFound() {
|
||||
void takeSnapshotContainerNotFound() {
|
||||
AwsException ex = assertThrows(AwsException.class, () ->
|
||||
manager.takeSnapshot(ACCOUNT_ID, "non-existent-cluster", "admin", "dev", Path.of("dummy.sql")));
|
||||
assertEquals("ClusterNotFound", ex.getErrorCode());
|
||||
@@ -118,7 +118,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreSnapshotContainerNotFound() {
|
||||
void restoreSnapshotContainerNotFound() {
|
||||
AwsException ex = assertThrows(AwsException.class, () ->
|
||||
manager.restoreSnapshot(ACCOUNT_ID, "non-existent-cluster", "admin", "dev", Path.of("dummy.sql")));
|
||||
assertEquals("ClusterNotFound", ex.getErrorCode());
|
||||
@@ -126,7 +126,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateSnapshotNullCluster() {
|
||||
void createSnapshotNullCluster() {
|
||||
AwsException ex = assertThrows(AwsException.class, () ->
|
||||
manager.createSnapshot(ACCOUNT_ID, null, Path.of("dummy.sql")));
|
||||
assertEquals("InvalidParameterValue", ex.getErrorCode());
|
||||
@@ -134,7 +134,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreSnapshotNullCluster() {
|
||||
void restoreSnapshotNullCluster() {
|
||||
AwsException ex = assertThrows(AwsException.class, () ->
|
||||
manager.restoreSnapshot(ACCOUNT_ID, (Cluster) null, Path.of("dummy.sql")));
|
||||
assertEquals("InvalidParameterValue", ex.getErrorCode());
|
||||
@@ -142,7 +142,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testTakeSnapshotSuccess() throws Exception {
|
||||
void takeSnapshotSuccess() throws Exception {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -201,7 +201,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testTakeSnapshotFailureExitCode() throws Exception {
|
||||
void takeSnapshotFailureExitCode() throws Exception {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -239,7 +239,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreSnapshotEmptyDump() {
|
||||
void restoreSnapshotEmptyDump() {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -253,7 +253,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRestoreSnapshotSuccess() throws Exception {
|
||||
void restoreSnapshotSuccess() throws Exception {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -298,7 +298,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStopRemovesContainer() {
|
||||
void stopRemovesContainer() {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -313,7 +313,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSameClusterIdentifierAcrossAccountsDoesNotCollide() {
|
||||
void sameClusterIdentifierAcrossAccountsDoesNotCollide() {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo infoA = new ContainerInfo("cont-account-a", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -332,7 +332,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAdoptOrStartAdoptsExistingContainerInsteadOfRecreatingIt() {
|
||||
void adoptOrStartAdoptsExistingContainerInsteadOfRecreatingIt() {
|
||||
String containerName = "floci-redshift-" + ACCOUNT_ID + "-test-cluster";
|
||||
Container existing = mock(Container.class);
|
||||
when(existing.getId()).thenReturn("cont-existing");
|
||||
@@ -345,13 +345,13 @@ class RedshiftContainerManagerTest {
|
||||
assertEquals("cont-existing", handle.getContainerId());
|
||||
assertEquals(6000, handle.getPort());
|
||||
assertTrue(manager.getContainer(ACCOUNT_ID, "test-cluster").isPresent());
|
||||
// Data lives only in the container's writable layer (no volume) — recreating it
|
||||
// Data lives only in the container's writable layer (no volume): recreating it
|
||||
// would silently discard it, so a container found by name must never be recreated.
|
||||
verify(lifecycleManager, never()).createAndStart(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAdoptOrStartFallsBackToStartWhenNoExistingContainer() {
|
||||
void adoptOrStartFallsBackToStartWhenNoExistingContainer() {
|
||||
String containerName = "floci-redshift-" + ACCOUNT_ID + "-test-cluster";
|
||||
when(lifecycleManager.findByName(containerName)).thenReturn(Optional.empty());
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
@@ -366,7 +366,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAlterUserPasswordSuccess() throws Exception {
|
||||
void alterUserPasswordSuccess() throws Exception {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -400,7 +400,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAlterUserPasswordContainerNotFound() {
|
||||
void alterUserPasswordContainerNotFound() {
|
||||
AwsException ex = assertThrows(AwsException.class, () ->
|
||||
manager.alterUserPassword(ACCOUNT_ID, "non-existent-cluster", "admin", "new-secret"));
|
||||
assertEquals("ClusterNotFound", ex.getErrorCode());
|
||||
@@ -408,7 +408,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAlterUserPasswordInvalidUsername() throws Exception {
|
||||
void alterUserPasswordInvalidUsername() throws Exception {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -429,7 +429,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAlterUserPasswordInvalidPassword() throws Exception {
|
||||
void alterUserPasswordInvalidPassword() throws Exception {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -462,7 +462,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAlterUserPasswordExecFailure() throws Exception {
|
||||
void alterUserPasswordExecFailure() throws Exception {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -499,7 +499,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStartAttachesLogStreamerAndToleratesFailure() throws Exception {
|
||||
void startAttachesLogStreamerAndToleratesFailure() throws Exception {
|
||||
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, RETURNS_SELF);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
|
||||
ContainerInfo info = new ContainerInfo("cont-stream", Map.of(5432, new EndpointInfo("localhost", 5432)));
|
||||
@@ -522,7 +522,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAdoptOrStartAttachesLogStreamerAndToleratesFailure() throws Exception {
|
||||
void adoptOrStartAttachesLogStreamerAndToleratesFailure() throws Exception {
|
||||
String containerName = "floci-redshift-" + ACCOUNT_ID + "-test-cluster";
|
||||
Container existing = mock(Container.class);
|
||||
when(existing.getId()).thenReturn("cont-adopt-stream");
|
||||
@@ -547,7 +547,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBootstrapCatalogSuccess() {
|
||||
void bootstrapCatalogSuccess() {
|
||||
CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(dockerClient.copyArchiveToContainerCmd("cont-bootstrap")).thenReturn(copyCmd);
|
||||
|
||||
@@ -570,7 +570,7 @@ class RedshiftContainerManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBootstrapCatalogFailureDoesNotThrow() {
|
||||
void bootstrapCatalogFailureDoesNotThrow() {
|
||||
CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
|
||||
when(copyCmd.exec()).thenThrow(new RuntimeException("Docker copy error"));
|
||||
when(dockerClient.copyArchiveToContainerCmd("cont-bootstrap-fail")).thenReturn(copyCmd);
|
||||
|
||||
+7
-6
@@ -20,6 +20,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
@@ -203,7 +204,7 @@ class S3CopySimulatorTest {
|
||||
CopyStatementParser.S3CopyFrom spec = new CopyStatementParser.S3CopyFrom(
|
||||
"t", List.of(), "b", "k", "|", 0, false, false, null, ROLE_ARN);
|
||||
IamService iamService = mock(IamService.class);
|
||||
when(iamService.findRole(any(), any())).thenReturn(java.util.Optional.empty());
|
||||
when(iamService.findRole(any(), any())).thenReturn(Optional.empty());
|
||||
|
||||
S3CopySimulator.S3TransferException error = assertThrows(
|
||||
S3CopySimulator.S3TransferException.class,
|
||||
@@ -252,7 +253,7 @@ class S3CopySimulatorTest {
|
||||
IamService iamService = mock(IamService.class);
|
||||
IamRole role = mock(IamRole.class);
|
||||
when(iamService.findRole("000000000000", "CopyRole"))
|
||||
.thenReturn(java.util.Optional.of(role));
|
||||
.thenReturn(Optional.of(role));
|
||||
when(role.getAssumeRolePolicyDocument()).thenReturn(""
|
||||
+ "{\"Statement\":[{\"Effect\":\"Allow\","
|
||||
+ "\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},"
|
||||
@@ -274,7 +275,7 @@ class S3CopySimulatorTest {
|
||||
"t", List.of(), "b", "k", "|", 0, false, false, null, ROLE_ARN);
|
||||
IamService iamService = mock(IamService.class);
|
||||
when(iamService.findRole(any(), any()))
|
||||
.thenReturn(java.util.Optional.of(mock(io.github.hectorvent.floci.services.iam.model.IamRole.class)));
|
||||
.thenReturn(Optional.of(mock(IamRole.class)));
|
||||
|
||||
S3CopySimulator.CopyInput input = S3CopySimulator.prepareCopy(spec, s3, iamService);
|
||||
|
||||
@@ -296,7 +297,7 @@ class S3CopySimulatorTest {
|
||||
"t", List.of(), "b", "k", "|", 0, false, false, null, ROLE_ARN);
|
||||
IamService iamService = mock(IamService.class);
|
||||
when(iamService.findRole(any(), any()))
|
||||
.thenReturn(java.util.Optional.of(mock(io.github.hectorvent.floci.services.iam.model.IamRole.class)));
|
||||
.thenReturn(Optional.of(mock(IamRole.class)));
|
||||
|
||||
S3CopySimulator.CopyInput input = S3CopySimulator.prepareCopy(spec, s3, iamService);
|
||||
S3CopySimulator.streamCopyInput(input, new ByteArrayOutputStream());
|
||||
@@ -1415,7 +1416,7 @@ class S3CopySimulatorTest {
|
||||
|
||||
String ndjson = "{\"id\": 1, \"name\": \"Alice\"}\n";
|
||||
ByteArrayOutputStream gzippedOut = new ByteArrayOutputStream();
|
||||
try (java.util.zip.GZIPOutputStream gzip = new java.util.zip.GZIPOutputStream(gzippedOut)) {
|
||||
try (GZIPOutputStream gzip = new GZIPOutputStream(gzippedOut)) {
|
||||
gzip.write(ndjson.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@@ -1537,7 +1538,7 @@ class S3CopySimulatorTest {
|
||||
IamRole role = mock(IamRole.class);
|
||||
when(role.getAssumeRolePolicyDocument()).thenReturn(
|
||||
"{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"redshift.amazonaws.com\"}}]}");
|
||||
when(iamService.findRole("000000000000", "Role")).thenReturn(java.util.Optional.of(role));
|
||||
when(iamService.findRole("000000000000", "Role")).thenReturn(Optional.of(role));
|
||||
|
||||
CopyStatementParser.S3CopyFrom spec = new CopyStatementParser.S3CopyFrom(
|
||||
"missing_table", List.of(), "wh", "data.json", null, 0, false, false, null,
|
||||
|
||||
+3
-1
@@ -3,6 +3,8 @@ package io.github.hectorvent.floci.services.redshiftdata;
|
||||
import io.github.hectorvent.floci.services.redshift.RedshiftService;
|
||||
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.response.ExtractableResponse;
|
||||
import io.restassured.response.Response;
|
||||
import jakarta.inject.Inject;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -92,7 +94,7 @@ class RedshiftDataApiIntegrationTest {
|
||||
assertEquals(2, asInt(insertRows));
|
||||
|
||||
String selectId = executeAndWait("SELECT id, name FROM t ORDER BY id");
|
||||
var result = RestAssuredJsonUtils.awsAction("RedshiftData", "GetStatementResult",
|
||||
ExtractableResponse<Response> result = RestAssuredJsonUtils.awsAction("RedshiftData", "GetStatementResult",
|
||||
"{\"Id\":\"" + selectId + "\"}").then().statusCode(200).extract();
|
||||
assertEquals(2, asInt(result.path("TotalNumRows")));
|
||||
assertEquals("id", result.path("ColumnMetadata[0].name"));
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.redshiftdata;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.h2.Driver;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,7 +32,7 @@ class RedshiftDataColumnMetadataTest {
|
||||
try (ResultSet rs = st.executeQuery("select id as id, name as name from t")) {
|
||||
ArrayNode columns = RedshiftDataColumnMetadata.toColumnMetadata(om, rs.getMetaData());
|
||||
assertEquals(2, columns.size());
|
||||
var id = columns.get(0);
|
||||
JsonNode id = columns.get(0);
|
||||
assertEquals("ID", id.get("name").asText().toUpperCase());
|
||||
assertTrue(id.has("label"));
|
||||
assertTrue(id.has("typeName"));
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.redshiftdata;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import org.h2.Driver;
|
||||
@@ -155,7 +156,7 @@ class RedshiftDataServiceTest {
|
||||
r.put("ClusterIdentifier", "wh");
|
||||
r.put("DbUser", "admin");
|
||||
r.put("Database", "dev");
|
||||
var array = r.putArray("Sqls");
|
||||
ArrayNode array = r.putArray("Sqls");
|
||||
for (String sql : sqls) {
|
||||
array.add(sql);
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.redshiftdata;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.SqlParameterParser.ParsedSql;
|
||||
@@ -72,7 +73,7 @@ class RedshiftDataSqlParametersTest {
|
||||
@Test
|
||||
void parseParametersReadsNameValueObjectsAndRejectsDuplicates() {
|
||||
ObjectNode request = om.createObjectNode();
|
||||
var params = request.putArray("Parameters");
|
||||
ArrayNode params = request.putArray("Parameters");
|
||||
params.addObject().put("name", "id").put("value", "1");
|
||||
params.addObject().put("name", "id").put("value", "2");
|
||||
AwsException e = assertThrows(AwsException.class,
|
||||
|
||||
Reference in new issue
Block a user