From 05153b30be80ad69b8334abfc0b1d36cd19f4e44 Mon Sep 17 00:00:00 2001 From: Allen Sanborn Date: Thu, 15 Oct 2026 20:07:14 -0500 Subject: [PATCH] feat(autoscaling): implement DescribeTags (#5750) * feat(autoscaling): implement DescribeTags DescribeTags returned UnsupportedOperation while CreateOrUpdateTags and DeleteTags already stored group tags. Serve it from those stored tags: filters auto-scaling-group, key, value and propagate-at-launch (values within a filter ORed, filters ANDed, unknown filter names rejected with ValidationError), MaxRecords/NextToken paging reusing the offset token DescribeInstanceRefreshes uses, results ordered by group then key. * fix(autoscaling): reject non-numeric MaxRecords and sparse filter indices in DescribeTags * fix(autoscaling): harden DescribeTags paging, vanished groups and oversized indices - rejectIndexGap compares member indices as BigInteger, so an index past int range is a 400 ValidationError instead of a NumberFormatException 500. - describeTags skips a null group value (deleted between StorageBackedMap's key snapshot and value read). - NextToken is now an opaque cursor on the last (group, key) returned, not an offset, so tags added or removed between pages are neither skipped nor repeated. - Import hamcrest containsString in the integration test. * fix(autoscaling): sign DescribeTags NextToken and route DescribeTags by Version A token that decodes to a (group, key) it was never issued for is now refused with InvalidNextToken, as AWS refuses a token it did not mint: the cursor carries an HMAC-SHA256 over region and cursor under a per-process key. DescribeTags joins the autoscaling action set so a request without a credential scope reaches autoscaling under its 2011-01-01 Version instead of ec2. * fix(autoscaling): bind DescribeTags NextToken to the account; per-instance HMAC key A static SecureRandom key can be initialized at native-image build time and baked into every process; hold it on the ApplicationScoped bean instead. The MAC now covers the caller's account id, so a token issued under one account is InvalidNextToken under another. * fix(autoscaling): draw the DescribeTags cursor key with nextBytes, not generateSeed * fix(autoscaling): AND repeated DescribeTags filters of the same name Each Filters.member entry is now its own filter, so two 'key' filters must both match instead of being merged into one ORed value list, per the Filter shape: multiple filters are joined with AND. Also cover a NextToken whose own cursor tag is deleted between pages. * fix(autoscaling): page DescribeTags through core Pagination, read filters to first gap Per review: the NextToken is now a (group, key) cursor through core.common.Pagination with a namespace and InvalidNextToken, replacing the HMAC, per-instance key and account binding (groups are stored per account, and the per-instance key voided every token on restart). rejectIndexGap is gone; filters are read up to the first missing index like every other member list in the handler. propagate-at-launch values match exactly, as the Filter model says values are case-sensitive. --- docs/services/autoscaling.md | 1 + .../floci/core/common/AwsQueryController.java | 2 +- .../autoscaling/AutoScalingQueryHandler.java | 43 +++ .../autoscaling/AutoScalingService.java | 40 +++ ...utoScalingDescribeTagsIntegrationTest.java | 301 ++++++++++++++++++ .../autoscaling/AutoScalingServiceTest.java | 3 + 6 files changed, 389 insertions(+), 1 deletion(-) create mode 100644 src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingDescribeTagsIntegrationTest.java diff --git a/docs/services/autoscaling.md b/docs/services/autoscaling.md index c2c0fd3956..1711ecd916 100644 --- a/docs/services/autoscaling.md +++ b/docs/services/autoscaling.md @@ -28,6 +28,7 @@ Floci implements the EC2 Auto Scaling API — stored-state management for launch | `DescribeAutoScalingGroups` | Filtered by name list; returns all if no filter; includes current instance list with lifecycle state and mixed instances policy shape when configured | | `UpdateAutoScalingGroup` | Updates capacity bounds, cooldown, launch source, AZs | | `DeleteAutoScalingGroup` | `ForceDelete=true` terminates all instances before deletion | +| `DescribeTags` | Group tags; filters `auto-scaling-group`, `key`, `value`, `propagate-at-launch` (values ORed, filters ANDed); `MaxRecords`/`NextToken` paging | | `EnableMetricsCollection` | Records the named group metrics, or all 20 when none are named, as `EnabledMetrics` on `DescribeAutoScalingGroups`. `Granularity` is required and must be `1Minute`; an unknown metric name raises `ValidationError`. No metrics are published to CloudWatch | | `DisableMetricsCollection` | Removes the named metrics from `EnabledMetrics`, or all of them when none are named | diff --git a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java index b77cc68471..3458ddbbd2 100644 --- a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java +++ b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java @@ -152,7 +152,7 @@ public class AwsQueryController { "CreateAutoScalingGroup", "UpdateAutoScalingGroup", "DeleteAutoScalingGroup", "DescribeAutoScalingGroups", "SetDesiredCapacity", "StartInstanceRefresh", "DescribeInstanceRefreshes", - "CreateOrUpdateTags", "DeleteTags", + "CreateOrUpdateTags", "DeleteTags", "DescribeTags", "DescribeAutoScalingInstances", "AttachInstances", "DetachInstances", "TerminateInstanceInAutoScalingGroup", "AttachLoadBalancerTargetGroups", "DetachLoadBalancerTargetGroups", diff --git a/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.java index 542a565067..31c41d98d1 100644 --- a/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.java +++ b/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.java @@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.autoscaling; import io.github.hectorvent.floci.core.common.AwsException; import io.github.hectorvent.floci.core.common.AwsNamespaces; import io.github.hectorvent.floci.core.common.AwsQueryResponse; +import io.github.hectorvent.floci.core.common.PaginatedResult; import io.github.hectorvent.floci.core.common.XmlBuilder; import io.github.hectorvent.floci.services.autoscaling.model.*; import jakarta.enterprise.context.ApplicationScoped; @@ -55,6 +56,7 @@ public class AutoScalingQueryHandler { case "DescribeInstanceRefreshes" -> handleDescribeInstanceRefreshes(p, region); case "CreateOrUpdateTags" -> handleCreateOrUpdateTags(p, region); case "DeleteTags" -> handleDeleteTags(p, region); + case "DescribeTags" -> handleDescribeTags(p, region); case "EnableMetricsCollection" -> handleEnableMetricsCollection(p, region); case "DisableMetricsCollection" -> handleDisableMetricsCollection(p, region); // Instances @@ -491,6 +493,47 @@ public class AutoScalingQueryHandler { .end("CreateOrUpdateTagsResponse").build()); } + private Response handleDescribeTags(MultivaluedMap p, String region) { + List>> filters = new ArrayList<>(); + for (int i = 1; ; i++) { + String name = p.getFirst("Filters.member." + i + ".Name"); + if (name == null) { break; } + filters.add(Map.entry(name, memberList(p, "Filters.member." + i + ".Values"))); + } + String maxRecords = p.getFirst("MaxRecords"); + Integer limit = null; + if (maxRecords != null && !maxRecords.isBlank()) { + try { + limit = Integer.parseInt(maxRecords); + } catch (NumberFormatException e) { + throw new AwsException("ValidationError", "MaxRecords '" + maxRecords + "' is not a valid integer.", 400); + } + } + PaginatedResult page = service.describeTags(region, filters, + limit, p.getFirst("NextToken")); + XmlBuilder xml = new XmlBuilder() + .start("DescribeTagsResponse", NS) + .start("DescribeTagsResult") + .start("Tags"); + for (AutoScalingService.TagDescription tag : page.items()) { + xml.start("member") + .elem("ResourceId", tag.resourceId()) + .elem("ResourceType", "auto-scaling-group") + .elem("Key", tag.key()) + .elem("Value", tag.value()) + .elem("PropagateAtLaunch", String.valueOf(tag.propagateAtLaunch())) + .end("member"); + } + xml.end("Tags"); + if (page.nextToken() != null) { + xml.elem("NextToken", page.nextToken()); + } + xml.end("DescribeTagsResult") + .raw(AwsQueryResponse.responseMetadata()) + .end("DescribeTagsResponse"); + return ok(xml.build()); + } + private Response handleEnableMetricsCollection(MultivaluedMap p, String region) { service.enableMetricsCollection(region, p.getFirst("AutoScalingGroupName"), memberList(p, "Metrics"), p.getFirst("Granularity")); diff --git a/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingService.java b/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingService.java index cf3957164e..72d8c8cccb 100644 --- a/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingService.java +++ b/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingService.java @@ -3,6 +3,8 @@ package io.github.hectorvent.floci.services.autoscaling; import com.fasterxml.jackson.core.type.TypeReference; import io.github.hectorvent.floci.core.common.AwsArnUtils; import io.github.hectorvent.floci.core.common.AwsException; +import io.github.hectorvent.floci.core.common.PaginatedResult; +import io.github.hectorvent.floci.core.common.Pagination; import io.github.hectorvent.floci.core.common.RegionResolver; import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend; import io.github.hectorvent.floci.core.storage.StorageBackedMap; @@ -558,6 +560,44 @@ public class AutoScalingService { groups.put(asgKey(region, asg.getAutoScalingGroupName()), asg); } + // AWS: values inside one filter are ORed, separate filters are ANDed; only these four + // filter names exist. Ordered by (group, key); NextToken is the last pair returned, so tags + // added or removed between pages neither skip nor repeat an entry. Values match exactly + // (the Filter model says they are case-sensitive). + public PaginatedResult describeTags(String region, List>> filters, + Integer maxRecords, String nextToken) { + for (Map.Entry> filter : filters) { + if (!Set.of("auto-scaling-group", "key", "value", "propagate-at-launch").contains(filter.getKey())) { + throw new AwsException("ValidationError", "Filter name '" + filter.getKey() + "' is not valid.", 400); + } + } + int limit = maxRecords != null ? Math.min(Math.max(maxRecords, 1), 100) : 50; + List matches = groups.values().stream() + .filter(Objects::nonNull) // group deleted between key snapshot and value read + .filter(g -> region.equals(g.getRegion())) + .flatMap(g -> g.getTags().entrySet().stream() + .map(t -> new TagDescription(g.getAutoScalingGroupName(), t.getKey(), t.getValue(), + g.getTagPropagateAtLaunch().getOrDefault(t.getKey(), false)))) + .filter(t -> matchesFilter(filters, "auto-scaling-group", t.resourceId()) + && matchesFilter(filters, "key", t.key()) + && matchesFilter(filters, "value", t.value()) + && matchesFilter(filters, "propagate-at-launch", String.valueOf(t.propagateAtLaunch()))) + .collect(Collectors.toList()); + // "\0" sorts below every other character, so the cursor orders as the (group, key) pair. + return Pagination.paginate(matches, + t -> t.resourceId() + "\0" + t.key(), limit, nextToken, "autoscaling-tags", + token -> new AwsException("InvalidNextToken", "The NextToken value is not valid.", 400)); + } + + // Every filter of this name must match (a repeated name is a second filter, ANDed). + private static boolean matchesFilter(List>> filters, String name, String actual) { + return filters.stream() + .filter(f -> f.getKey().equals(name) && !f.getValue().isEmpty()) + .allMatch(f -> f.getValue().contains(actual)); + } + + public record TagDescription(String resourceId, String key, String value, boolean propagateAtLaunch) {} + private AutoScalingGroup requireTaggableGroup(String region, String resourceId, String resourceType) { if (!"auto-scaling-group".equals(resourceType)) { throw new AwsException("ValidationError", diff --git a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingDescribeTagsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingDescribeTagsIntegrationTest.java new file mode 100644 index 0000000000..be41a89b00 --- /dev/null +++ b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingDescribeTagsIntegrationTest.java @@ -0,0 +1,301 @@ +package io.github.hectorvent.floci.services.autoscaling; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.path.xml.XmlPath; +import io.restassured.specification.RequestSpecification; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.List; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.containsString; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * DescribeTags over the tags CreateAutoScalingGroup and CreateOrUpdateTags store. Tags are read + * back through DescribeTags itself, never trusted from the mutating call's response. + */ +@QuarkusTest +class AutoScalingDescribeTagsIntegrationTest { + + private static final String AUTH = + "AWS4-HMAC-SHA256 Credential=test/20260501/us-east-1/autoscaling/aws4_request"; + private static final String ROOT = "DescribeTagsResponse.DescribeTagsResult.Tags.member"; + + private static final String GROUP_A = "describe-tags-a"; + private static final String GROUP_B = "describe-tags-b"; + private static final String LC = "describe-tags-lc"; + + private static boolean created; + + // Not @BeforeAll: a static hook runs before the Quarkus test server is listening. + @BeforeEach + void createGroups() { + if (created) { return; } + created = true; + given() + .formParam("Action", "CreateLaunchConfiguration") + .formParam("LaunchConfigurationName", LC) + .formParam("ImageId", "ami-12345678") + .formParam("InstanceType", "t3.micro") + .header("Authorization", AUTH) + .when().post("/") + .then().statusCode(200); + createGroup(GROUP_A, "AsgId", "1", true); + createGroup(GROUP_B, "AsgId", "2", false); + given() + .formParam("Action", "CreateOrUpdateTags") + .formParam("Tags.member.1.ResourceId", GROUP_A) + .formParam("Tags.member.1.ResourceType", "auto-scaling-group") + .formParam("Tags.member.1.Key", "team") + .formParam("Tags.member.1.Value", "blue") + .formParam("Tags.member.1.PropagateAtLaunch", "false") + .header("Authorization", AUTH) + .when().post("/") + .then().statusCode(200); + } + + // The corpus call: terraform-aws-asg's get-desired-capacity.py finds its group by + // describe_tags(Filters=[{Name: key, Values: [AsgId]}, {Name: value, Values: []}]). + @Test + void keyAndValueFiltersFindTheOneGroup() { + XmlPath xml = describe() + .formParam("Filters.member.1.Name", "key") + .formParam("Filters.member.1.Values.member.1", "AsgId") + .formParam("Filters.member.2.Name", "value") + .formParam("Filters.member.2.Values.member.1", "1") + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + + assertEquals(List.of(GROUP_A), xml.getList(ROOT + ".ResourceId")); + assertEquals("auto-scaling-group", xml.getString(ROOT + ".ResourceType")); + assertEquals("AsgId", xml.getString(ROOT + ".Key")); + assertEquals("1", xml.getString(ROOT + ".Value")); + assertEquals("true", xml.getString(ROOT + ".PropagateAtLaunch")); + } + + @Test + void autoScalingGroupFilterReturnsEveryTagOfThatGroupSortedByKey() { + XmlPath xml = describe() + .formParam("Filters.member.1.Name", "auto-scaling-group") + .formParam("Filters.member.1.Values.member.1", GROUP_A) + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + + assertEquals(List.of("AsgId", "team"), xml.getList(ROOT + ".Key")); + assertEquals(List.of("true", "false"), xml.getList(ROOT + ".PropagateAtLaunch")); + } + + // Values inside one filter are ORed; separate filters are ANDed. + @Test + void valuesWithinAFilterAreOredAndPropagateAtLaunchFilters() { + XmlPath xml = describe() + .formParam("Filters.member.1.Name", "auto-scaling-group") + .formParam("Filters.member.1.Values.member.1", GROUP_A) + .formParam("Filters.member.1.Values.member.2", GROUP_B) + .formParam("Filters.member.2.Name", "propagate-at-launch") + .formParam("Filters.member.2.Values.member.1", "false") + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + + assertEquals(List.of(GROUP_A, GROUP_B), xml.getList(ROOT + ".ResourceId")); + assertEquals(List.of("team", "AsgId"), xml.getList(ROOT + ".Key")); + } + + // Two filters with the same name are still two filters: ANDed, not merged into one ORed list. + @Test + void repeatedFilterNamesAreAndedNotMerged() { + XmlPath xml = describe() + .formParam("Filters.member.1.Name", "key") + .formParam("Filters.member.1.Values.member.1", "AsgId") + .formParam("Filters.member.1.Values.member.2", "team") + .formParam("Filters.member.2.Name", "key") + .formParam("Filters.member.2.Values.member.1", "team") + .formParam("Filters.member.3.Name", "auto-scaling-group") + .formParam("Filters.member.3.Values.member.1", GROUP_A) + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + + assertEquals(List.of("team"), xml.getList(ROOT + ".Key")); + } + + @Test + void maxRecordsPagesWithNextToken() { + XmlPath first = describe() + .formParam("Filters.member.1.Name", "auto-scaling-group") + .formParam("Filters.member.1.Values.member.1", GROUP_A) + .formParam("Filters.member.1.Values.member.2", GROUP_B) + .formParam("MaxRecords", "2") + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + assertEquals(2, first.getList(ROOT + ".Key").size()); + String token = first.getString("DescribeTagsResponse.DescribeTagsResult.NextToken"); + assertNotNull(token); + + XmlPath second = describe() + .formParam("Filters.member.1.Name", "auto-scaling-group") + .formParam("Filters.member.1.Values.member.1", GROUP_A) + .formParam("Filters.member.1.Values.member.2", GROUP_B) + .formParam("MaxRecords", "2") + .formParam("NextToken", token) + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + assertEquals(List.of(GROUP_B), second.getList(ROOT + ".ResourceId")); + assertEquals("", second.getString("DescribeTagsResponse.DescribeTagsResult.NextToken")); + } + + @Test + void unknownFilterNameIsAValidationError() { + describe() + .formParam("Filters.member.1.Name", "tag-key") + .formParam("Filters.member.1.Values.member.1", "AsgId") + .when().post("/") + .then().statusCode(400) + .body(containsString("ValidationError")); + } + + @Test + void nonNumericMaxRecordsIsAValidationError() { + describe() + .formParam("MaxRecords", "abc") + .when().post("/") + .then().statusCode(400) + .body(containsString("ValidationError")); + } + + // Like every other member list in this handler, filters are read up to the first missing index. + @Test + void filtersAreReadUpToTheFirstMissingIndex() { + XmlPath xml = describe() + .formParam("Filters.member.1.Name", "auto-scaling-group") + .formParam("Filters.member.1.Values.member.1", GROUP_B) + .formParam("Filters.member.3.Name", "key") + .formParam("Filters.member.3.Values.member.1", "no-such-key") + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + + assertEquals(List.of("AsgId"), xml.getList(ROOT + ".Key")); + } + + // Filter values are case-sensitive (AWS Filter model), propagate-at-launch included. + @Test + void propagateAtLaunchFilterIsCaseSensitive() { + XmlPath xml = describe() + .formParam("Filters.member.1.Name", "auto-scaling-group") + .formParam("Filters.member.1.Values.member.1", GROUP_A) + .formParam("Filters.member.2.Name", "propagate-at-launch") + .formParam("Filters.member.2.Values.member.1", "True") + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + + assertEquals(List.of(), xml.getList(ROOT + ".Key")); + } + + // A tag deleted from an already-returned page must not shift the next page past an unread tag. + @Test + void nextTokenSurvivesATagDeletedBeforeTheCursor() { + assertSecondPageAfterDeleting("describe-tags-cursor", "k1"); + } + + // The exact tag the NextToken encodes is deleted: the next page resumes at the first greater + // key, rather than failing or restarting the listing. + @Test + void nextTokenSurvivesDeletingTheCursorTagItself() { + assertSecondPageAfterDeleting("describe-tags-cursor-gone", "k2"); + } + + // Group has tags k1, k2, k3; the first page (MaxRecords=2) returns k1, k2, so the token encodes k2. + private static void assertSecondPageAfterDeleting(String group, String deletedKey) { + createGroup(group, "k1", "v", false); + given() + .formParam("Action", "CreateOrUpdateTags") + .formParam("Tags.member.1.ResourceId", group) + .formParam("Tags.member.1.ResourceType", "auto-scaling-group") + .formParam("Tags.member.1.Key", "k2") + .formParam("Tags.member.1.Value", "v") + .formParam("Tags.member.2.ResourceId", group) + .formParam("Tags.member.2.ResourceType", "auto-scaling-group") + .formParam("Tags.member.2.Key", "k3") + .formParam("Tags.member.2.Value", "v") + .header("Authorization", AUTH) + .when().post("/") + .then().statusCode(200); + + XmlPath first = describe() + .formParam("Filters.member.1.Name", "auto-scaling-group") + .formParam("Filters.member.1.Values.member.1", group) + .formParam("MaxRecords", "2") + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + assertEquals(List.of("k1", "k2"), first.getList(ROOT + ".Key")); + String token = first.getString("DescribeTagsResponse.DescribeTagsResult.NextToken"); + + given() + .formParam("Action", "DeleteTags") + .formParam("Tags.member.1.ResourceId", group) + .formParam("Tags.member.1.ResourceType", "auto-scaling-group") + .formParam("Tags.member.1.Key", deletedKey) + .header("Authorization", AUTH) + .when().post("/") + .then().statusCode(200); + + XmlPath second = describe() + .formParam("Filters.member.1.Name", "auto-scaling-group") + .formParam("Filters.member.1.Values.member.1", group) + .formParam("MaxRecords", "2") + .formParam("NextToken", token) + .when().post("/") + .then().statusCode(200).extract().xmlPath(); + assertEquals(List.of("k3"), second.getList(ROOT + ".Key")); + } + + @Test + void garbageNextTokenIsInvalidNextToken() { + describe() + .formParam("NextToken", "!!not-a-token!!") + .when().post("/") + .then().statusCode(400) + .body(containsString("InvalidNextToken")); + } + + // A token that decodes to a plausible (group, key) but lacks this list's namespace was not + // minted here. + @Test + void tokenWithoutTheNamespaceIsInvalidNextToken() { + assertInvalidNextToken(Base64.getUrlEncoder().encodeToString( + (GROUP_A + "\0AsgId").getBytes(StandardCharsets.UTF_8))); + } + + private static void assertInvalidNextToken(String token) { + describe() + .formParam("NextToken", token) + .when().post("/") + .then().statusCode(400) + .body(containsString("InvalidNextToken")); + } + + private static RequestSpecification describe() { + return given().formParam("Action", "DescribeTags").header("Authorization", AUTH); + } + + private static void createGroup(String name, String key, String value, boolean propagate) { + given() + .formParam("Action", "CreateAutoScalingGroup") + .formParam("AutoScalingGroupName", name) + .formParam("LaunchConfigurationName", LC) + .formParam("MinSize", "0") + .formParam("MaxSize", "1") + .formParam("DesiredCapacity", "0") + .formParam("AvailabilityZones.member.1", "us-east-1a") + .formParam("Tags.member.1.Key", key) + .formParam("Tags.member.1.Value", value) + .formParam("Tags.member.1.PropagateAtLaunch", String.valueOf(propagate)) + .header("Authorization", AUTH) + .when().post("/") + .then().statusCode(200); + } +} diff --git a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingServiceTest.java index 9db721db53..32626b90cb 100644 --- a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingServiceTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingServiceTest.java @@ -929,11 +929,14 @@ class AutoScalingServiceTest { groups.putAll(service.groups); service.groups = groups; service.attachInstances(REGION, "test-asg", List.of("i-live")); + service.createOrUpdateTags(REGION, "test-asg", "auto-scaling-group", Map.of("k", "v"), Map.of()); assertFalse(service.describeAutoScalingGroups(null, null).contains(null)); assertEquals(List.of("test-asg"), service.describeAutoScalingGroups(REGION, null).stream() .map(AutoScalingGroup::getAutoScalingGroupName).toList()); assertEquals(1, service.describeAutoScalingInstances(REGION, null).size()); + assertEquals(List.of("k"), service.describeTags(REGION, List.of(), null, null).items().stream() + .map(AutoScalingService.TagDescription::key).toList()); service.setInstanceHealth(REGION, "i-live", "Unhealthy", false); service.terminateInstanceInAutoScalingGroup(REGION, "i-live", false);