diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformIntegrationTest.java index 08aef74772..6c04721526 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformIntegrationTest.java @@ -521,7 +521,7 @@ class SamTransformIntegrationTest { } @Test - void samFunction_viaChangeSet_createsLambda() { + void samFunction_viaChangeSet_createsLambda() throws Exception { String stackName = "sam-changeset-stack"; stacksToDelete.add(stackName); @@ -562,15 +562,23 @@ class SamTransformIntegrationTest { .then() .statusCode(200); - given() - .contentType("application/x-www-form-urlencoded") - .formParam("Action", "DescribeStacks") - .formParam("StackName", stackName) - .when() - .post("/") - .then() - .statusCode(200) - .body(containsString("CREATE_COMPLETE")); + String describeBody = null; + for (int attempt = 0; attempt < 50; attempt++) { + describeBody = given() + .contentType("application/x-www-form-urlencoded") + .formParam("Action", "DescribeStacks") + .formParam("StackName", stackName) + .when() + .post("/") + .then() + .statusCode(200) + .extract().asString(); + if (describeBody.contains("CREATE_COMPLETE")) { + break; + } + Thread.sleep(100); + } + assertThat(describeBody, containsString("CREATE_COMPLETE")); given() .when()