@@ -912,6 +912,81 @@ describe('staging', () => {
912
912
expect ( dockerStubInput ) . not . toMatch ( DockerStubCommand . MULTIPLE_FILES ) ;
913
913
} ) ;
914
914
915
+ test ( 'correctly skips bundling with stack under stage and custom stack name' , ( ) => {
916
+ // GIVEN
917
+ const app = new App ( ) ;
918
+
919
+ const stage = new Stage ( app , 'Stage' ) ;
920
+ stage . node . setContext ( cxapi . BUNDLING_STACKS , [ 'Stage/Stack1' ] ) ;
921
+
922
+ const stack1 = new Stack ( stage , 'Stack1' , { stackName : 'unrelated-stack1-name' } ) ;
923
+ const stack2 = new Stack ( stage , 'Stack2' , { stackName : 'unrelated-stack2-name' } ) ;
924
+ const directory = path . join ( __dirname , 'fs' , 'fixtures' , 'test1' ) ;
925
+
926
+ // WHEN
927
+ new AssetStaging ( stack1 , 'Asset' , {
928
+ sourcePath : directory ,
929
+ assetHashType : AssetHashType . OUTPUT ,
930
+ bundling : {
931
+ image : DockerImage . fromRegistry ( 'alpine' ) ,
932
+ command : [ DockerStubCommand . SUCCESS ] ,
933
+ } ,
934
+ } ) ;
935
+
936
+ new AssetStaging ( stack2 , 'Asset' , {
937
+ sourcePath : directory ,
938
+ assetHashType : AssetHashType . OUTPUT ,
939
+ bundling : {
940
+ image : DockerImage . fromRegistry ( 'alpine' ) ,
941
+ command : [ DockerStubCommand . MULTIPLE_FILES ] ,
942
+ } ,
943
+ } ) ;
944
+
945
+ // THEN
946
+ const dockerStubInput = readDockerStubInputConcat ( ) ;
947
+ // Docker ran for the asset in Stack1
948
+ expect ( dockerStubInput ) . toMatch ( DockerStubCommand . SUCCESS ) ;
949
+ // Docker did not run for the asset in Stack2
950
+ expect ( dockerStubInput ) . not . toMatch ( DockerStubCommand . MULTIPLE_FILES ) ;
951
+ } ) ;
952
+
953
+ test ( 'correctly bundles with stack under stage and the default stack pattern' , ( ) => {
954
+ // GIVEN
955
+ const app = new App ( ) ;
956
+
957
+ const stage = new Stage ( app , 'Stage' ) ;
958
+
959
+ const stack1 = new Stack ( stage , 'Stack1' ) ;
960
+ const stack2 = new Stack ( stage , 'Stack2' ) ;
961
+ const directory = path . join ( __dirname , 'fs' , 'fixtures' , 'test1' ) ;
962
+
963
+ // WHEN
964
+ new AssetStaging ( stack1 , 'Asset' , {
965
+ sourcePath : directory ,
966
+ assetHashType : AssetHashType . OUTPUT ,
967
+ bundling : {
968
+ image : DockerImage . fromRegistry ( 'alpine' ) ,
969
+ command : [ DockerStubCommand . SUCCESS ] ,
970
+ } ,
971
+ } ) ;
972
+
973
+ new AssetStaging ( stack2 , 'Asset' , {
974
+ sourcePath : directory ,
975
+ assetHashType : AssetHashType . OUTPUT ,
976
+ bundling : {
977
+ image : DockerImage . fromRegistry ( 'alpine' ) ,
978
+ command : [ DockerStubCommand . MULTIPLE_FILES ] ,
979
+ } ,
980
+ } ) ;
981
+
982
+ // THEN
983
+ const dockerStubInput = readDockerStubInputConcat ( ) ;
984
+ // Docker ran for the asset in Stack1
985
+ expect ( dockerStubInput ) . toMatch ( DockerStubCommand . SUCCESS ) ;
986
+ // Docker ran for the asset in Stack2
987
+ expect ( dockerStubInput ) . toMatch ( DockerStubCommand . MULTIPLE_FILES ) ;
988
+ } ) ;
989
+
915
990
test ( 'bundling still occurs with partial wildcard' , ( ) => {
916
991
// GIVEN
917
992
const app = new App ( ) ;
0 commit comments