diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayRestApiCfnUpdateRollbackRetryIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayRestApiCfnUpdateRollbackRetryIntegrationTest.java index cf9cb111b1..2bd58d2c5e 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayRestApiCfnUpdateRollbackRetryIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayRestApiCfnUpdateRollbackRetryIntegrationTest.java @@ -88,13 +88,12 @@ class ApiGatewayRestApiCfnUpdateRollbackRetryIntegrationTest { .body("endpointConfiguration.types", contains("REGIONAL")); assertPaths(apiId, "/", "/items"); - cfn("ContinueUpdateRollback", stack).when().post("/").then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, null); state = CfnStackWaits.awaitTerminal(stack); assertEquals("UPDATE_ROLLBACK_FAILED", state.status(), state.reason()); assertEquals("Rollback is not implemented for AWS::ApiGateway::RestApi", apiResourceReason(stack)); - cfn("ContinueUpdateRollback", stack).formParam("ResourcesToSkip.member.1", "Api") - .when().post("/").then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, null, "Api"); state = CfnStackWaits.awaitTerminal(stack); assertEquals("UPDATE_ROLLBACK_COMPLETE", state.status(), state.reason()); } finally { @@ -124,7 +123,7 @@ class ApiGatewayRestApiCfnUpdateRollbackRetryIntegrationTest { .body("description", equalTo("second")) .body("endpointConfiguration.types", contains("EDGE")); - cfn("ContinueUpdateRollback", stack).when().post("/").then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, null); state = CfnStackWaits.awaitTerminal(stack); assertEquals("UPDATE_ROLLBACK_COMPLETE", state.status(), state.reason()); given().when().get("/restapis/" + apiId).then().statusCode(200) diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayUsagePlanCfnRollbackIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayUsagePlanCfnRollbackIntegrationTest.java index 828f136cd1..0ce2ed7846 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayUsagePlanCfnRollbackIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayUsagePlanCfnRollbackIntegrationTest.java @@ -169,7 +169,7 @@ class ApiGatewayUsagePlanCfnRollbackIntegrationTest { .body("name", equalTo("apigw-usageplan-retry-changed")) .body("quota.limit", equalTo(50)); - cloudFormation(stack, "ContinueUpdateRollback", null); + CfnStackWaits.continueUpdateRollback(stack, CFN_AUTH); assertEquals(planId, outputValue(describeStacks(stack, "UPDATE_ROLLBACK_COMPLETE"), "PlanRef")); getUsagePlan(planId) .statusCode(200) diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetUpdateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetUpdateIntegrationTest.java index 7a83ff83f5..56a7331d47 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetUpdateIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetUpdateIntegrationTest.java @@ -264,7 +264,7 @@ class CloudFormationElbV2SubnetUpdateIntegrationTest { failUpdateOntoAnAddedSubnet(stack); - continueUpdateRollback(stack); + CfnStackWaits.continueUpdateRollback(stack, CFN_AUTH); CfnStackWaits.awaitStatus(stack, "UPDATE_ROLLBACK_COMPLETE"); assertEquals(before, Set.copyOf(loadBalancerSubnets(created.get("Alb")))); assertEquals(before, Set.copyOf(vpcSubnets(created.get("Vpc")))); @@ -292,11 +292,11 @@ class CloudFormationElbV2SubnetUpdateIntegrationTest { addedSubnet.removeAll(Set.of(created.get("SubnetA"), created.get("SubnetB"))); assertEquals(1, addedSubnet.size()); - continueUpdateRollback(stack, "Alb"); + CfnStackWaits.continueUpdateRollback(stack, CFN_AUTH, "Alb"); CfnStackWaits.StackState stillFailed = CfnStackWaits.awaitStatus(stack, "UPDATE_ROLLBACK_FAILED"); assertTrue(stillFailed.reason().contains("SubnetC"), stillFailed.reason()); - continueUpdateRollback(stack, "SubnetC"); + CfnStackWaits.continueUpdateRollback(stack, CFN_AUTH, "SubnetC"); CfnStackWaits.awaitStatus(stack, "UPDATE_ROLLBACK_COMPLETE"); assertEquals(Set.of(created.get("SubnetA"), addedSubnet.iterator().next()), Set.copyOf(loadBalancerSubnets(created.get("Alb")))); @@ -326,17 +326,6 @@ class CloudFormationElbV2SubnetUpdateIntegrationTest { assertTrue(reason.contains("Alb") && reason.contains("SubnetC"), reason); } - private static void continueUpdateRollback(String stack, String... resourcesToSkip) { - String[] values = new String[2 + resourcesToSkip.length * 2]; - values[0] = "StackName"; - values[1] = stack; - for (int i = 0; i < resourcesToSkip.length; i++) { - values[2 + i * 2] = "ResourcesToSkip.member." + (i + 1); - values[3 + i * 2] = resourcesToSkip[i]; - } - request(CFN_AUTH, "ContinueUpdateRollback", values).statusCode(200); - } - /** * A failed rollback restores the parameters but can leave a resource on the branch the failed * update chose: here the load balancer stays on the subnets an Fn::If picked for the new diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventsV2SubscriberIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventsV2SubscriberIntegrationTest.java index 6934a4380c..a165ea3ea1 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventsV2SubscriberIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventsV2SubscriberIntegrationTest.java @@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import static io.github.hectorvent.floci.testing.CfnRequests.cfn; import static io.github.hectorvent.floci.testing.CfnStackWaits.awaitStackDeleted; import static io.github.hectorvent.floci.testing.CfnStackWaits.awaitStatus; +import static io.github.hectorvent.floci.testing.CfnStackWaits.continueUpdateRollback; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; @@ -162,7 +163,7 @@ class CloudFormationEventsV2SubscriberIntegrationTest { () -> events.describeSubscriber(request -> request.subscriberArn(subscriberArn))); restoresFail.set(false); - cfn("ContinueUpdateRollback", stack).post("/").then().statusCode(200); + continueUpdateRollback(stack, null); awaitStatus(stack, "UPDATE_ROLLBACK_COMPLETE"); assertEquals("UNORDERED", events.describeSubscriber(request -> request.subscriberArn(subscriberArn)) diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNatGatewayLeftoverIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNatGatewayLeftoverIntegrationTest.java index 25a36ad1ae..8002f0f4a9 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNatGatewayLeftoverIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNatGatewayLeftoverIntegrationTest.java @@ -70,7 +70,7 @@ class CloudFormationNatGatewayLeftoverIntegrationTest { assertTrue(reason.contains("Nat"), reason); failNatDeletes.set(false); - request("ContinueUpdateRollback", "StackName", stack, "ResourcesToSkip.member.1", "Nat").statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, CFN_AUTH, "Nat"); CfnStackWaits.awaitStatus(stack, "UPDATE_ROLLBACK_COMPLETE"); assertEquals(1, XmlParser.extractAll(ec2("DescribeNatGateways", "Filter.1.Name", "subnet-id", "Filter.1.Value.1", created.get("Subnet")).statusCode(200).extract().asString(), "natGatewayId") diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNestedStackLeftoverIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNestedStackLeftoverIntegrationTest.java index e1f553813b..7c3742f1a9 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNestedStackLeftoverIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNestedStackLeftoverIntegrationTest.java @@ -90,8 +90,7 @@ class CloudFormationNestedStackLeftoverIntegrationTest { assertTrue(reason.contains("Network"), reason); failSubnetDeletes.set(false); - request("ContinueUpdateRollback", "StackName", stack, "ResourcesToSkip.member.1", "Network") - .statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, CFN_AUTH, "Network"); CfnStackWaits.awaitStatus(stack, "UPDATE_ROLLBACK_COMPLETE"); assertEquals(1, XmlParser.extractAll(ec2("DescribeSubnets", "Filter.1.Name", "vpc-id", "Filter.1.Value.1", created.get("Vpc")).statusCode(200).extract().asString(), "subnetId") diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPipesCleanupIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPipesCleanupIntegrationTest.java index 46f05f6600..fb826da99b 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPipesCleanupIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPipesCleanupIntegrationTest.java @@ -399,15 +399,7 @@ class CloudFormationPipesCleanupIntegrationTest { // AWS refuses an update over UPDATE_ROLLBACK_FAILED. The pipe's rollback already restored // the prior pipe and only failed to delete the replacement, so skipping it finishes the // rollback and the stack takes updates again. - given() - .contentType("application/x-www-form-urlencoded") - .formParam("Action", "ContinueUpdateRollback") - .formParam("StackName", stackName) - .formParam("ResourcesToSkip.member.1", "MyPipe") - .when() - .post("/") - .then() - .statusCode(200); + CfnStackWaits.continueUpdateRollback(stackName, null, "MyPipe"); assertEquals("UPDATE_ROLLBACK_COMPLETE", CfnStackWaits.awaitTerminal(stackName).status()); Mockito.doCallRealMethod().when(pipesService).deletePipe(eq(replacementName), anyString()); diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java index 6b5fd4892b..93c7f143c0 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java @@ -766,7 +766,7 @@ class CloudFormationRoute53RecordSetIntegrationTest { assertTrue(listResourceRecordSets(oldZone).contains("192.0.2.1"), "the old record was touched"); assertTrue(listResourceRecordSets(newZone).contains("192.0.2.2"), "the refused delete went through"); - continueUpdateRollback(stackName); + CfnStackWaits.continueUpdateRollback(stackName, CFN_AUTH); CfnStackWaits.StackState state = CfnStackWaits.awaitTerminal(stackName); assertEquals("UPDATE_ROLLBACK_COMPLETE", state.status(), state.reason()); assertFalse(listResourceRecordSets(newZone).contains(name), "the retry left the moved record"); @@ -797,7 +797,7 @@ class CloudFormationRoute53RecordSetIntegrationTest { refuseFirstGroupDeleteIn(newZone); updateStack(stackName, groupTemplate(newZone, groupRecord(name, "192.0.2.2"), "", FAILS_AFTER_GROUP)); assertEquals("UPDATE_ROLLBACK_FAILED", CfnStackWaits.awaitTerminal(stackName).status()); - continueUpdateRollback(stackName, "Group"); + CfnStackWaits.continueUpdateRollback(stackName, CFN_AUTH, "Group"); assertEquals("UPDATE_ROLLBACK_COMPLETE", CfnStackWaits.awaitTerminal(stackName).status()); // The skipped group names the old zone's record again, as the restored template does, so @@ -844,7 +844,7 @@ class CloudFormationRoute53RecordSetIntegrationTest { refuseFirstGroupDeleteIn(newZone); updateStack(stackName, groupTemplate(newZone, groupRecord(name, "192.0.2.2"), "", FAILS_AFTER_GROUP)); assertEquals("UPDATE_ROLLBACK_FAILED", CfnStackWaits.awaitTerminal(stackName).status()); - continueUpdateRollback(stackName, "Group"); + CfnStackWaits.continueUpdateRollback(stackName, CFN_AUTH, "Group"); assertEquals("UPDATE_ROLLBACK_COMPLETE", CfnStackWaits.awaitTerminal(stackName).status()); // The record the failed update left is deleted by hand, and the move is applied again. @@ -878,7 +878,7 @@ class CloudFormationRoute53RecordSetIntegrationTest { refuseFirstGroupDeleteIn(newZone); updateStack(stackName, groupTemplate(newZone, groupRecord(name, "192.0.2.2"), "", FAILS_AFTER_GROUP)); assertEquals("UPDATE_ROLLBACK_FAILED", CfnStackWaits.awaitTerminal(stackName).status()); - continueUpdateRollback(stackName, "Group"); + CfnStackWaits.continueUpdateRollback(stackName, CFN_AUTH, "Group"); assertEquals("UPDATE_ROLLBACK_COMPLETE", CfnStackWaits.awaitTerminal(stackName).status()); // The leftover is deleted by hand, and a record set of the same stack writes the same record. @@ -1020,18 +1020,6 @@ class CloudFormationRoute53RecordSetIntegrationTest { .when(route53Service).changeResourceRecordSets(eq(zoneId), anyList(), eq("CloudFormation delete Group")); } - private void continueUpdateRollback(String stackName, String... resourcesToSkip) { - RequestSpecification request = given() - .contentType("application/x-www-form-urlencoded") - .header("Authorization", CFN_AUTH) - .formParam("Action", "ContinueUpdateRollback") - .formParam("StackName", stackName); - for (int i = 0; i < resourcesToSkip.length; i++) { - request.formParam("ResourcesToSkip.member." + (i + 1), resourcesToSkip[i]); - } - request.when().post("/").then().statusCode(200); - } - /** * One TCP health check; {@code failing} adds a record set in a zone that does not exist, created * after the check, so the update fails once the check has been replaced. diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSchedulerScheduleIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSchedulerScheduleIntegrationTest.java index 6e479e3025..1773ad8630 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSchedulerScheduleIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSchedulerScheduleIntegrationTest.java @@ -295,7 +295,7 @@ class CloudFormationSchedulerScheduleIntegrationTest { Queue queue = sqs.createQueue("external-" + suffix, Map.of(), "us-east-1"); prepareFailedRollback(stack, name, queue); allowOriginalRestore(name); - continueUpdateRollback(stack); + CfnStackWaits.continueUpdateRollback(stack, AUTH); outputs(stack, "UPDATE_ROLLBACK_COMPLETE"); cloudFormation(stack, "UpdateStack", externalQueueTemplate(FAILURE, queue), @@ -321,7 +321,7 @@ class CloudFormationSchedulerScheduleIntegrationTest { assertUpdateRefused(stack, externalQueueTemplate("", queue), Map.of("Name", name, "Expression", "rate(15 minutes)", "Payload", "third")); - continueUpdateRollback(stack); + CfnStackWaits.continueUpdateRollback(stack, AUTH); outputs(stack, "UPDATE_ROLLBACK_FAILED"); getSchedule(name, "default").then().statusCode(200) @@ -505,7 +505,7 @@ class CloudFormationSchedulerScheduleIntegrationTest { .when(scheduler).deleteSchedule(replacementName, "default", "us-east-1"); // With its delete still failing, the rollback finishes only by skipping the schedule, which // keeps the replacement owed when the next update recreates it at the same address. - continueUpdateRollback(stack, "Schedule"); + CfnStackWaits.continueUpdateRollback(stack, AUTH, "Schedule"); outputs(stack, "UPDATE_ROLLBACK_COMPLETE"); // Change both resources so the engine actually retries the replacement and its failing dependent. @@ -625,7 +625,7 @@ class CloudFormationSchedulerScheduleIntegrationTest { recreateScheduleViaApi(name, "default"); try { - continueUpdateRollback(stack); + CfnStackWaits.continueUpdateRollback(stack, AUTH); outputs(stack, "UPDATE_ROLLBACK_COMPLETE"); getSchedule(name, "default").then().statusCode(200) .body("ScheduleExpression", equalTo("rate(5 minutes)")) @@ -685,7 +685,7 @@ class CloudFormationSchedulerScheduleIntegrationTest { && group.equals(request.getGroupName())), eq("us-east-1")); try { - continueUpdateRollback(stack); + CfnStackWaits.continueUpdateRollback(stack, AUTH); outputs(stack, "UPDATE_ROLLBACK_COMPLETE"); assertTrue(pausedRecreatedDestination.get()); getSchedule(name, group).then().statusCode(404); @@ -1063,14 +1063,6 @@ class CloudFormationSchedulerScheduleIntegrationTest { .body(containsString("is in UPDATE_ROLLBACK_FAILED state and can not be updated.")); } - private static void continueUpdateRollback(String stack, String... resourcesToSkip) { - RequestSpecification request = cloudFormationRequest(stack, "ContinueUpdateRollback", null, Map.of()); - for (int i = 0; i < resourcesToSkip.length; i++) { - request.formParam("ResourcesToSkip.member." + (i + 1), resourcesToSkip[i]); - } - request.post("/").then().statusCode(200); - } - private static Map outputs(String stack, String expectedStatus) { assertEquals(expectedStatus, CfnStackWaits.awaitTerminal(stack).status()); String body = given().contentType("application/x-www-form-urlencoded").header("Authorization", AUTH) diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSesEmailIdentityIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSesEmailIdentityIntegrationTest.java index 0b1906063b..2aa67ae2b8 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSesEmailIdentityIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSesEmailIdentityIntegrationTest.java @@ -8,6 +8,7 @@ import io.github.hectorvent.floci.core.common.XmlParser; import io.github.hectorvent.floci.services.ses.SesIdentityService; import io.github.hectorvent.floci.services.ses.SesService; import io.github.hectorvent.floci.services.ses.model.Identity; +import io.github.hectorvent.floci.testing.CfnStackWaits; import io.github.hectorvent.floci.testing.MutableClock; import io.github.hectorvent.floci.testing.RestAssuredJsonUtils; import io.quarkus.test.junit.QuarkusTest; @@ -595,7 +596,7 @@ class CloudFormationSesEmailIdentityIntegrationTest { assertEquals(false, sesIdentity(identityName).jsonPath().getBoolean("FeedbackForwardingStatus")); assertEquals("new", sesIdentity(identityName).jsonPath() .getString("Tags.find { it.Key == 'purpose' }.Value")); - cfn("ContinueUpdateRollback", null).then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, stackAuth); awaitStatus("UPDATE_ROLLBACK_COMPLETE"); String nextIdentity = replacing ? "replacement-" + identityName : identityName; ObjectNode secondAttempt = (ObjectNode) MAPPER.readTree(template(nextIdentity, false)); @@ -649,7 +650,7 @@ class CloudFormationSesEmailIdentityIntegrationTest { try { cfn("UpdateStack", failed.toString()).then().statusCode(200); awaitStatus("UPDATE_ROLLBACK_FAILED"); - continueUpdateRollbackSkipping("Identity").then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, stackAuth, "Identity"); awaitStatus("UPDATE_ROLLBACK_COMPLETE"); doThrow(new AwsException("ServiceUnavailableException", "replacement unavailable", 503)) .when(sesService).createEmailIdentity(eq(replacement), isNull(), any(), eq("us-east-1")); @@ -708,7 +709,7 @@ class CloudFormationSesEmailIdentityIntegrationTest { ObjectNode outputsOnly = (ObjectNode) MAPPER.readTree(template(identityName, true)); outputsOnly.withObject("/Outputs").set("Marker", MAPPER.valueToTree(Map.of("Value", "cleanup"))); cfn("UpdateStack", outputsOnly.toString()).then().statusCode(400); - cfn("ContinueUpdateRollback", null).then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, stackAuth); String failedAgain = awaitStatus("UPDATE_ROLLBACK_FAILED"); assertEquals(null, XmlParser.extractPairs(failedAgain, "Outputs", "OutputKey", "OutputValue").get("Marker")); @@ -761,7 +762,7 @@ class CloudFormationSesEmailIdentityIntegrationTest { try { cfn("UpdateStack", failed.toString()).then().statusCode(200); awaitStatus("UPDATE_ROLLBACK_FAILED"); - cfn("ContinueUpdateRollback", null).then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, stackAuth); awaitStatus("UPDATE_ROLLBACK_COMPLETE"); ObjectNode outputsOnly = (ObjectNode) MAPPER.readTree(template(identityName, true)); @@ -800,7 +801,7 @@ class CloudFormationSesEmailIdentityIntegrationTest { try { cfn("UpdateStack", firstFailure.toString()).then().statusCode(200); awaitStatus("UPDATE_ROLLBACK_FAILED"); - cfn("ContinueUpdateRollback", null).then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, stackAuth); awaitStatus("UPDATE_ROLLBACK_COMPLETE"); ObjectNode secondFailure = (ObjectNode) MAPPER.readTree(template(identityName, true)); @@ -1085,15 +1086,6 @@ class CloudFormationSesEmailIdentityIntegrationTest { return request.post("/"); } - private Response continueUpdateRollbackSkipping(String logicalId) { - return given().contentType("application/x-www-form-urlencoded") - .header("Authorization", stackAuth) - .formParam("Action", "ContinueUpdateRollback") - .formParam("StackName", stack) - .formParam("ResourcesToSkip.member.1", logicalId) - .post("/"); - } - private Response sesIdentity(String identity) { return given().header("Authorization", SES_AUTH).get("/v2/email/identities/{identity}", identity); } diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmRollbackIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmRollbackIntegrationTest.java index 4a38d7729e..76c41f7c3c 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmRollbackIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmRollbackIntegrationTest.java @@ -10,7 +10,6 @@ import io.github.hectorvent.floci.testing.RestAssuredJsonUtils; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; import io.restassured.response.Response; -import io.restassured.specification.RequestSpecification; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -226,7 +225,7 @@ class CloudFormationSsmRollbackIntegrationTest { assertTrue(failed.reason().contains("Parameter"), failed.reason()); assertEquals("after", value(name)); - continueUpdateRollback(stack, null); + CfnStackWaits.continueUpdateRollback(stack, null); CfnStackWaits.StackState retried = CfnStackWaits.awaitTerminal(stack); assertEquals("UPDATE_ROLLBACK_COMPLETE", retried.status(), retried.reason()); @@ -254,7 +253,7 @@ class CloudFormationSsmRollbackIntegrationTest { Mockito.doCallRealMethod().when(ssmService).deleteParameter(eq(target), anyString()); } - continueUpdateRollback(stack, null); + CfnStackWaits.continueUpdateRollback(stack, null); CfnStackWaits.StackState retried = CfnStackWaits.awaitTerminal(stack); assertEquals("UPDATE_ROLLBACK_COMPLETE", retried.status(), retried.reason()); @@ -278,7 +277,7 @@ class CloudFormationSsmRollbackIntegrationTest { deploy("UpdateStack", stack, template(true, new Param("Parameter", name, "two"))); assertEquals("UPDATE_ROLLBACK_FAILED", CfnStackWaits.awaitTerminal(stack).status()); - continueUpdateRollback(stack, "Parameter"); + CfnStackWaits.continueUpdateRollback(stack, null, "Parameter"); CfnStackWaits.StackState skipped = CfnStackWaits.awaitTerminal(stack); assertEquals("UPDATE_ROLLBACK_COMPLETE", skipped.status(), skipped.reason()); @@ -307,7 +306,7 @@ class CloudFormationSsmRollbackIntegrationTest { try { deploy("UpdateStack", stack, template(true, new Param("Parameter", target, "two"))); assertEquals("UPDATE_ROLLBACK_FAILED", CfnStackWaits.awaitTerminal(stack).status()); - continueUpdateRollback(stack, "Parameter"); + CfnStackWaits.continueUpdateRollback(stack, null, "Parameter"); CfnStackWaits.StackState skipped = CfnStackWaits.awaitTerminal(stack); assertEquals("UPDATE_ROLLBACK_COMPLETE", skipped.status(), skipped.reason()); } finally { @@ -467,7 +466,7 @@ class CloudFormationSsmRollbackIntegrationTest { } assertEquals("after", value(name)); - continueUpdateRollback(stack, null); + CfnStackWaits.continueUpdateRollback(stack, null); CfnStackWaits.StackState retried = CfnStackWaits.awaitTerminal(stack); assertEquals("UPDATE_ROLLBACK_COMPLETE", retried.status(), retried.reason()); @@ -524,14 +523,6 @@ class CloudFormationSsmRollbackIntegrationTest { cfn(action, stack).formParam("TemplateBody", template).post("/").then().statusCode(200); } - private static void continueUpdateRollback(String stack, String skip) { - RequestSpecification request = cfn("ContinueUpdateRollback", stack); - if (skip != null) { - request.formParam("ResourcesToSkip.member.1", skip); - } - request.post("/").then().statusCode(200); - } - private static void deleteStack(String stack) { cfn("DeleteStack", stack).post("/").then().statusCode(200); CfnStackWaits.awaitStackDeleted(stack); diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoResourceServerCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoResourceServerCfnIntegrationTest.java index 67974e8cdd..73033f8444 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoResourceServerCfnIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoResourceServerCfnIntegrationTest.java @@ -716,15 +716,7 @@ class CognitoResourceServerCfnIntegrationTest { } private void continueUpdateRollback(String expectedStatus, String... resourcesToSkip) { - RequestSpecification request = given() - .contentType("application/x-www-form-urlencoded") - .header("Authorization", CFN_AUTH) - .formParam("Action", "ContinueUpdateRollback") - .formParam("StackName", stack); - for (int i = 0; i < resourcesToSkip.length; i++) { - request.formParam("ResourcesToSkip.member." + (i + 1), resourcesToSkip[i]); - } - request.when().post("/").then().statusCode(200); + CfnStackWaits.continueUpdateRollback(stack, CFN_AUTH, resourcesToSkip); assertEquals(expectedStatus, CfnStackWaits.awaitTerminal(stack).status()); }