From aeb11d77c3d2103793571d678c9885f7014f08e4 Mon Sep 17 00:00:00 2001 From: Hector Ventura Date: Sat, 27 Jun 2026 00:53:42 -0500 Subject: [PATCH] test(autoscaling): scope mixed-policy override assertion to Overrides block (#1609) updateMixedInstancesPolicyOverridesAndDistribution asserted that the DescribeAutoScalingGroups response contained no t4g.medium anywhere after switching the override to r7g.large. The background AutoScalingReconciler may have already launched an instance with the original t4g.medium override, which legitimately keeps its instance type after a policy update (matching AWS). That instance appears under , making the whole-response assertion flaky. Scope the negative check to the block so it verifies the policy was updated without being tripped by a previously launched instance. --- .../autoscaling/AutoScalingIntegrationTest.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingIntegrationTest.java index e61a64a73e..5a5604160d 100644 --- a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingIntegrationTest.java @@ -745,7 +745,7 @@ class AutoScalingIntegrationTest { .statusCode(200) .body(containsString("UpdateAutoScalingGroupResponse")); - given() + String describeBody = given() .formParam("Action", "DescribeAutoScalingGroups") .formParam("AutoScalingGroupNames.member.1", "my-mixed-asg") .header("Authorization", AUTH) @@ -755,10 +755,17 @@ class AutoScalingIntegrationTest { .statusCode(200) .body(containsString("5")) .body(containsString("r7g.large")) - .body(not(containsString("t4g.medium"))) .body(containsString("2")) .body(containsString("50")) - .body(containsString("price-capacity-optimized")); + .body(containsString("price-capacity-optimized")) + .extract().asString(); + + // Scope the negative check to the policy overrides: a previously launched + // instance keeps its original instance type after a policy update (matching + // AWS), so t4g.medium may still appear under . + String overrides = describeBody.substring( + describeBody.indexOf(""), describeBody.indexOf("")); + assertThat(overrides, not(containsString("t4g.medium"))); } @Test