-
Notifications
You must be signed in to change notification settings - Fork 793
fix(cloudformation): refresh stacks after changeset is deleted #8351
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
Merged
laileni-aws
merged 7 commits into
aws:master
from
Zee2413:fix/cfn/changeset-refresh-stacks
Nov 21, 2025
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
12e7711
fix(cloudformation): refresh stacks after changeset is deleted
Zee2413 fd90498
add unit test and use globals setInterval
Zee2413 72f4b7e
remove unused stub
Zee2413 ceadbba
stub globals setInterval
Zee2413 5e559bb
add cfn prefix in changelog
Zee2413 d90fa90
typo in changelog
Zee2413 e2d3807
Merge branch 'master' into fix/cfn/changeset-refresh-stacks
Zee2413 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
.../core/src/test/awsService/cloudformation/stacks/actions/changeSetDeletionWorkflow.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /*! | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import assert from 'assert' | ||
| import { SinonSandbox, SinonStub, createSandbox } from 'sinon' | ||
| import { commands } from 'vscode' | ||
| import { ChangeSetDeletion } from '../../../../../awsService/cloudformation/stacks/actions/changeSetDeletionWorkflow' | ||
| import { | ||
| StackActionPhase, | ||
| StackActionState, | ||
| } from '../../../../../awsService/cloudformation/stacks/actions/stackActionRequestType' | ||
| import { commandKey } from '../../../../../awsService/cloudformation/utils' | ||
| import { globals } from '../../../../../shared' | ||
|
|
||
| describe('ChangeSetDeletion', function () { | ||
| let sandbox: SinonSandbox | ||
|
|
||
| beforeEach(function () { | ||
| sandbox = createSandbox() | ||
| }) | ||
|
|
||
| afterEach(function () { | ||
| sandbox.restore() | ||
| }) | ||
|
|
||
| describe('delete', function () { | ||
| let mockClient: any | ||
| let executeCommandStub: SinonStub | ||
| let getChangeSetDeletionStatusStub: SinonStub | ||
| let describeChangeSetDeletionStatusStub: SinonStub | ||
|
|
||
| beforeEach(function () { | ||
| mockClient = { sendRequest: sandbox.stub().resolves({}) } | ||
| executeCommandStub = sandbox.stub(commands, 'executeCommand').resolves() | ||
|
|
||
| const stackActionApi = require('../../../../../awsService/cloudformation/stacks/actions/stackActionApi') | ||
| getChangeSetDeletionStatusStub = sandbox.stub(stackActionApi, 'getChangeSetDeletionStatus') | ||
| describeChangeSetDeletionStatusStub = sandbox.stub(stackActionApi, 'describeChangeSetDeletionStatus') | ||
| sandbox.stub(stackActionApi, 'deleteChangeSet').resolves() | ||
|
|
||
| sandbox.stub(globals.clock, 'setInterval').callsFake((callback: () => void) => { | ||
| setImmediate(() => callback()) | ||
| return 1 as any | ||
| }) | ||
| sandbox.stub(globals.clock, 'clearInterval') | ||
| }) | ||
|
|
||
| it('should call refresh command after successful deletion', async function () { | ||
| getChangeSetDeletionStatusStub.resolves({ | ||
| phase: StackActionPhase.DELETION_COMPLETE, | ||
| state: StackActionState.SUCCESSFUL, | ||
| }) | ||
|
|
||
| const deletion = new ChangeSetDeletion('test-stack', 'test-changeset', mockClient) | ||
| await deletion.delete() | ||
| await new Promise((resolve) => setImmediate(resolve)) | ||
|
|
||
| assert.ok(executeCommandStub.calledWith(commandKey('stacks.refresh'))) | ||
| }) | ||
|
|
||
| it('should call refresh command after failed deletion', async function () { | ||
| getChangeSetDeletionStatusStub.resolves({ phase: StackActionPhase.DELETION_FAILED }) | ||
| describeChangeSetDeletionStatusStub.resolves({ FailureReason: 'Test failure' }) | ||
|
|
||
| const deletion = new ChangeSetDeletion('test-stack', 'test-changeset', mockClient) | ||
| await deletion.delete() | ||
| await new Promise((resolve) => setImmediate(resolve)) | ||
|
|
||
| assert.ok(executeCommandStub.calledWith(commandKey('stacks.refresh'))) | ||
| }) | ||
|
|
||
| it('should not call refresh command when polling encounters error', async function () { | ||
| getChangeSetDeletionStatusStub.rejects(new Error('Polling error')) | ||
|
|
||
| const deletion = new ChangeSetDeletion('test-stack', 'test-changeset', mockClient) | ||
| await deletion.delete() | ||
| await new Promise((resolve) => setImmediate(resolve)) | ||
|
|
||
| assert.ok(executeCommandStub.calledWith(commandKey('stacks.refresh'))) | ||
| }) | ||
| }) | ||
| }) |
4 changes: 4 additions & 0 deletions
4
packages/toolkit/.changes/next-release/Bug Fix-20f1c834-8e8b-47a2-ab09-4a24df3e959e.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "Bug Fix", | ||
| "description": "Refresh stacks after change set deletion" | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.