File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
packages/@aws-cdk-testing/cli-integ
tests/cli-integ-tests/destroy Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -993,6 +993,10 @@ switch (stackSet) {
993993 case 'stage-with-no-stacks' :
994994 break ;
995995
996+ case 'stage-only' :
997+ new SomeStage ( app , `${ stackPrefix } -stage` ) ;
998+ break ;
999+
9961000 default :
9971001 throw new Error ( `Unrecognized INTEG_STACK_SET: '${ stackSet } '` ) ;
9981002}
Original file line number Diff line number Diff line change 1+ import { DescribeStacksCommand } from '@aws-sdk/client-cloudformation' ;
2+ import { integTest , withDefaultFixture } from '../../../lib' ;
3+
4+ integTest ( 'cdk destroy can destroy stacks in stage-only configuration with --all option' , withDefaultFixture ( async ( fixture ) => {
5+ const integStackSet = 'stage-only' ;
6+
7+ await fixture . cdkDeploy ( [ ] , {
8+ options : [ '--all' ] ,
9+ modEnv : {
10+ INTEG_STACK_SET : integStackSet ,
11+ } ,
12+ } ) ;
13+
14+ const stackName = `${ fixture . fullStackName ( 'stage' ) } -StackInStage` ;
15+ const stack = await fixture . aws . cloudFormation . send ( new DescribeStacksCommand ( { StackName : stackName } ) ) ;
16+ expect ( stack . Stacks ?. length ?? 0 ) . toEqual ( 1 ) ;
17+
18+ await fixture . cdkDestroy ( [ ] , {
19+ options : [ '--all' ] ,
20+ modEnv : {
21+ INTEG_STACK_SET : integStackSet ,
22+ } ,
23+ } ) ;
24+
25+ await expect ( fixture . aws . cloudFormation . send ( new DescribeStacksCommand ( { StackName : stackName } ) ) )
26+ . rejects . toThrow ( / d o e s n o t e x i s t / ) ;
27+ } ) ) ;
You can’t perform that action at this time.
0 commit comments