Light, fluffy, and always free - The AWS Local Emulator alternative
test: use generic tag and key fixtures instead of a downstream project's names (#4119)
lex009e1e97471234
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecr/EcrServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/ecr/EcrServiceTest.javaindex 60d95a0fc1..e71f5acd60 100644--- a/src/test/java/io/github/hectorvent/floci/services/ecr/EcrServiceTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/ecr/EcrServiceTest.java@@ -165,7 +165,7 @@ class EcrServiceTest {when(registryManager.tryEnsureStarted()).thenReturn(false);Repository repo = service.createRepository(REPO, null, "IMMUTABLE", true, null, null,- Map.of("Project", "choudoufu"), REGION);+ Map.of("Project", "platform"), REGION);assertEquals(REPO, repo.getRepositoryName());assertEquals(ACCOUNT, repo.getRegistryId());@@ -173,7 +173,7 @@ class EcrServiceTest {repo.getRepositoryArn());assertTrue(repo.getRepositoryUri().endsWith("/" + REPO), repo.getRepositoryUri());assertEquals("IMMUTABLE", repo.getImageTagMutability());- assertEquals("choudoufu", repo.getTags().get("Project"));+ assertEquals("platform", repo.getTags().get("Project"));}@Testdiff --git a/src/test/java/io/github/hectorvent/floci/services/eks/EksServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/eks/EksServiceTest.javaindex a84a6644e4..49d4287176 100644--- a/src/test/java/io/github/hectorvent/floci/services/eks/EksServiceTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/eks/EksServiceTest.java@@ -1058,13 +1058,13 @@ class EksServiceTest {CreateClusterRequest request = new CreateClusterRequest();request.setName("probe-eks");request.setRoleArn("arn:aws:iam::000000000000:role/eks-role");- request.setTags(Map.of("tofu-estate", "probe1"));+ request.setTags(Map.of("team", "probe1"));Cluster cluster = service.createCluster(request);assertEquals(ClusterStatus.ACTIVE, cluster.getStatus());assertEquals("https://localhost:6500", cluster.getEndpoint());- assertEquals("probe1", cluster.getTags().get("tofu-estate"));+ assertEquals("probe1", cluster.getTags().get("team"));// No k3s API server exists. The empty CA is what says so.assertEquals("", cluster.getCertificateAuthority().getData());assertNull(cluster.getContainerId());@@ -1079,12 +1079,12 @@ class EksServiceTest {CreateClusterRequest request = new CreateClusterRequest();request.setName("probe-eks");request.setRoleArn("arn:aws:iam::000000000000:role/eks-role");- request.setTags(Map.of("tofu-estate", "probe1"));+ request.setTags(Map.of("team", "probe1"));String arn = service.createCluster(request).getArn();assertEquals(ClusterStatus.ACTIVE, service.describeCluster("probe-eks").getStatus());assertEquals(List.of("probe-eks"), service.listClusters());- assertEquals("probe1", service.listTagsForResource(arn).get("tofu-estate"));+ assertEquals("probe1", service.listTagsForResource(arn).get("team"));service.tagResource(arn, Map.of("Name", "probe-eks"));assertEquals("probe-eks", service.listTagsForResource(arn).get("Name"));diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.javaindex af23f175ad..5a2d1b0150 100644--- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java@@ -1714,12 +1714,12 @@ class RdsServiceTest {DbInstance instance = rdsService.createDbInstance("probe-db", "postgres", "16.3","probeadmin", "ProbePassw0rd!", "dbname", "db.t3.micro",20, false, null, null, null, false, null,- Map.of("tofu-estate", "probe1"));+ Map.of("team", "probe1"));assertEquals(DbInstanceStatus.AVAILABLE, instance.getStatus());assertEquals("arn:aws:rds:us-east-1:123456789012:db:probe-db", instance.getDbInstanceArn());assertNotNull(instance.getEndpoint());- assertEquals("probe1", instance.getTags().get("tofu-estate"));+ assertEquals("probe1", instance.getTags().get("team"));// Nothing was started, so no runtime is claimed; the storage identity is kept for the retry.assertNull(instance.getContainerId());assertNull(instance.getContainerHost());@@ -1737,10 +1737,10 @@ class RdsServiceTest {DbInstance created = rdsService.createDbInstance("probe-db", "postgres", "16.3","probeadmin", "ProbePassw0rd!", "dbname", "db.t3.micro",20, false, null, null, null, false, null,- Map.of("tofu-estate", "probe1"));+ Map.of("team", "probe1"));assertEquals(1, rdsService.listDbInstances("probe-db").size());- assertEquals("probe1", rdsService.listTagsForResource(created.getDbInstanceArn()).get("tofu-estate"));+ assertEquals("probe1", rdsService.listTagsForResource(created.getDbInstanceArn()).get("team"));rdsService.addTagsToResource(created.getDbInstanceArn(), Map.of("Name", "probe-db"), "us-east-1");assertEquals("probe-db", rdsService.listTagsForResource(created.getDbInstanceArn()).get("Name"));diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3VirtualHostIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3VirtualHostIntegrationTest.javaindex cb2c7c7d24..457459ae7b 100644--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3VirtualHostIntegrationTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3VirtualHostIntegrationTest.java@@ -7,6 +7,7 @@ import org.junit.jupiter.api.Test;import org.junit.jupiter.api.TestMethodOrder;import static io.restassured.RestAssured.given;+import static org.junit.jupiter.api.Assertions.assertEquals;import static org.hamcrest.Matchers.*;/**@@ -417,7 +418,7 @@ class S3VirtualHostIntegrationTest {}// A key may contain the bucket's own name as a path segment, for example- // "tofu-records/<bucket>/...". The raw request path of a virtual-hosted request is the key+ // "archive/<bucket>/...". The raw request path of a virtual-hosted request is the key// alone, so the "/<bucket>/" inside it is part of the key and not the path-style bucket// prefix.@Test@@ -429,7 +430,7 @@ class S3VirtualHostIntegrationTest {String segmentHost = segmentBucket + ".localhost";given().header("Host", segmentHost).when().put("/").then().statusCode(200);- String key = "tofu-records/" + segmentBucket + "/.store-sentinel";+ String key = "archive/" + segmentBucket + "/.sentinel";given().header("Host", segmentHost).contentType("text/plain")@@ -442,7 +443,7 @@ class S3VirtualHostIntegrationTest {given().header("Host", segmentHost).queryParam("list-type", "2")- .queryParam("prefix", "tofu-records/" + segmentBucket + "/")+ .queryParam("prefix", "archive/" + segmentBucket + "/").when().get("/").then()@@ -457,11 +458,17 @@ class S3VirtualHostIntegrationTest {.statusCode(200).body(equalTo("sentinel"));- // And nothing was stored under the truncated key.+ // And nothing was stored under the truncated key: what would remain if the "/<bucket>/"+ // inside the key were mistaken for the path-style bucket prefix and stripped. Derived from+ // the key rather than written out, so renaming the key cannot leave this asking for a+ // third key that neither behaviour ever stores.+ String truncated = key.substring(key.indexOf("/" + segmentBucket + "/")+ + segmentBucket.length() + 2);+ assertEquals(".sentinel", truncated, "the guard below must name the truncation, not a third key");given().header("Host", segmentHost).when()- .get("/.store-sentinel")+ .get("/" + truncated).then().statusCode(404);}