@@ -826,10 +826,12 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
826
826
} ) ;
827
827
} ) ;
828
828
829
- test ( 'can hotswap a lambda function in a 1-level nested stack with dependency on a output of sibling stack' , async ( ) => {
830
- // GIVEN: RootStack has two child stacks `NestedLambdaStack` and `NestedSiblingStack`. `NestedLambdaStack`
831
- // takes two parameters s3Key and s3Bucket and use them for a Lambda function.
832
- // RootStack resolves s3Bucket from a root template parameter and s3Key through output of `NestedSiblingStack`
829
+ test ( 'can hotswap a lambda function in a 2-level nested stack with dependency on a output of 2nd level sibling stack' , async ( ) => {
830
+ // GIVEN: RootStack has one child stack `FirstLevelRootStack` which further has two child stacks
831
+ // `NestedLambdaStack` and `NestedSiblingStack`. `NestedLambdaStack` takes two parameters s3Key
832
+ // and s3Bucket and use them for a Lambda function.
833
+ // RootStack resolves s3Bucket from a root template parameter and passed to FirstLevelRootStack which
834
+ // resolves s3Key through output of `NestedSiblingStack`
833
835
hotswapMockSdkProvider = setup . setupHotswapNestedStackTests ( 'RootStack' ) ;
834
836
mockUpdateLambdaCode = jest . fn ( ) . mockReturnValue ( { } ) ;
835
837
hotswapMockSdkProvider . stubLambda ( {
@@ -838,6 +840,34 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
838
840
839
841
const rootStack = testStack ( {
840
842
stackName : 'RootStack' ,
843
+ template : {
844
+ Resources : {
845
+ FirstLevelRootStack : {
846
+ Type : 'AWS::CloudFormation::Stack' ,
847
+ Properties : {
848
+ TemplateURL : 'https://www.magic-url.com' ,
849
+ Parameters : {
850
+ S3BucketParam : {
851
+ Ref : 'S3BucketParam' ,
852
+ } ,
853
+ } ,
854
+ } ,
855
+ Metadata : {
856
+ 'aws:asset:path' : 'one-stack-with-two-nested-stacks-stack.template.json' ,
857
+ } ,
858
+ } ,
859
+ } ,
860
+ Parameters : {
861
+ S3BucketParam : {
862
+ Type : 'String' ,
863
+ Description : 'S3 bucket for asset' ,
864
+ } ,
865
+ } ,
866
+ } ,
867
+ } ) ;
868
+
869
+ const firstLevelRootStack = testStack ( {
870
+ stackName : 'FirstLevelRootStack' ,
841
871
template : {
842
872
Resources : {
843
873
NestedLambdaStack : {
@@ -869,11 +899,11 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
869
899
'aws:asset:path' : 'one-output-stack.nested.template.json' ,
870
900
} ,
871
901
} ,
872
- Parameters : {
873
- S3BucketParam : {
874
- Type : 'String' ,
875
- Description : 'S3 bucket for asset ' ,
876
- } ,
902
+ } ,
903
+ Parameters : {
904
+ S3BucketParam : {
905
+ Type : 'String ' ,
906
+ Description : 'S3 bucket for asset' ,
877
907
} ,
878
908
} ,
879
909
} ,
@@ -913,10 +943,17 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
913
943
} ) ;
914
944
915
945
setup . addTemplateToCloudFormationLookupMock ( rootStack ) ;
946
+ setup . addTemplateToCloudFormationLookupMock ( firstLevelRootStack ) ;
916
947
setup . addTemplateToCloudFormationLookupMock ( nestedLambdaStack ) ;
917
948
setup . addTemplateToCloudFormationLookupMock ( nestedSiblingStack ) ;
918
949
919
950
setup . pushNestedStackResourceSummaries ( 'RootStack' ,
951
+ setup . stackSummaryOf ( 'FirstLevelRootStack' , 'AWS::CloudFormation::Stack' ,
952
+ 'arn:aws:cloudformation:bermuda-triangle-1337:123456789012:stack/FirstLevelRootStack/abcd' ,
953
+ ) ,
954
+ ) ;
955
+
956
+ setup . pushNestedStackResourceSummaries ( 'FirstLevelRootStack' ,
920
957
setup . stackSummaryOf ( 'NestedLambdaStack' , 'AWS::CloudFormation::Stack' ,
921
958
'arn:aws:cloudformation:bermuda-triangle-1337:123456789012:stack/NestedLambdaStack/abcd' ,
922
959
) ,
0 commit comments