Skip to content

Commit 8ed0e09

Browse files
authored
test(e2e): fix e2e resources stack deployment (#3772)
* test(e2e): fix e2e resources stack deployment
1 parent 61df0f9 commit 8ed0e09

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/e2e/ensure-test-stack.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ const {
1313
* Deploy the integration test stack if it does not exist. Update the
1414
* stack if there's a changeset. There should be a high level library for it
1515
* really.
16+
*
17+
* This is a boil-down version of aws cli cloudformation deploy:
18+
* https://github.com/aws/aws-cli/blob/c3eec161713ffd7e01c239bd0761fcf02db183aa/awscli/customizations/cloudformation/deploy.py#L321
1619
*/
1720
exports.ensureTestStack = async (client, stackName, templateBody) => {
1821
let hasExistingStack = false;
1922
try {
20-
await client.send(new DescribeStacksCommand({ StackName: stackName }));
21-
hasExistingStack = true;
23+
const { Stacks } = await client.send(new DescribeStacksCommand({ StackName: stackName }));
24+
hasExistingStack = Stacks[0]?.StackStatus !== "REVIEW_IN_PROGRESS";
2225
} catch (e) {
2326
if ((e.message || "").endsWith("does not exist")) {
2427
hasExistingStack = false;
@@ -31,7 +34,7 @@ exports.ensureTestStack = async (client, stackName, templateBody) => {
3134
new CreateChangeSetCommand({
3235
StackName: stackName,
3336
ChangeSetType: hasExistingStack ? "UPDATE" : "CREATE",
34-
ChangeSetName: `${stackName}ChangeSet`,
37+
ChangeSetName: `${stackName}ChangeSet${Date.now()}`,
3538
TemplateBody: templateBody,
3639
Capabilities: [Capability.CAPABILITY_IAM],
3740
})

0 commit comments

Comments
 (0)