mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(cloudformation): poll for CREATE_COMPLETE in SAM changeset test (#1199)
SamTransformIntegrationTest.samFunction_viaChangeSet_createsLambda asserted CREATE_COMPLETE immediately after ExecuteChangeSet, which provisions the stack asynchronously. On slower/variable runners the assertion raced the async work and intermittently observed CREATE_IN_PROGRESS, failing unrelated PRs' CI. Poll DescribeStacks until the stack reaches CREATE_COMPLETE (bounded to ~5s) before asserting. Test-only change; the async ExecuteChangeSet behavior is correct AWS semantics and is left untouched.
This commit is contained in:
1 parent
4446404288
commit
42168cee17
1 file changed
+18
-10
+18
-10
@@ -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("<StackStatus>CREATE_COMPLETE</StackStatus>"));
|
||||
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("<StackStatus>CREATE_COMPLETE</StackStatus>")) {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(100);
|
||||
}
|
||||
assertThat(describeBody, containsString("<StackStatus>CREATE_COMPLETE</StackStatus>"));
|
||||
|
||||
given()
|
||||
.when()
|
||||
|
||||
Reference in new issue
Block a user