Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: delete integration stacks serially #14506

Merged
merged 2 commits into from
May 4, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/aws-cdk/test/integ/helpers/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export class AwsClients {
public async deleteStacks(...stackNames: string[]) {
if (stackNames.length === 0) { return; }

// We purposely do all stacks serially, because they've been ordered
// to do the bootstrap stack last.
for (const stackName of stackNames) {
await this.cloudFormation('updateTerminationProtection', {
EnableTerminationProtection: false,
Expand All @@ -53,19 +55,17 @@ export class AwsClients {
await this.cloudFormation('deleteStack', {
StackName: stackName,
});
}

await retry(this.output, `Deleting ${stackNames}`, retry.forSeconds(600), async () => {
for (const stackName of stackNames) {
await retry(this.output, `Deleting ${stackName}`, retry.forSeconds(600), async () => {
const status = await this.stackStatus(stackName);
if (status !== undefined && status.endsWith('_FAILED')) {
throw retry.abort(new Error(`'${stackName}' is in state '${status}'`));
}
if (status !== undefined) {
throw new Error(`Delete of '${stackName}' not complete yet`);
}
}
});
});
}
}

public async stackStatus(stackName: string): Promise<string | undefined> {
Expand Down