@@ -17,7 +17,7 @@ const mockEcsDescribeServices = jest.fn();
17
17
const mockCodeDeployCreateDeployment = jest . fn ( ) ;
18
18
const mockCodeDeployGetDeploymentGroup = jest . fn ( ) ;
19
19
const config = {
20
- region : ( ) => Promise . resolve ( 'fake-region' ) ,
20
+ region : ( ) => Promise . resolve ( 'fake-region' ) ,
21
21
} ;
22
22
23
23
jest . mock ( '@aws-sdk/client-codedeploy' ) ;
@@ -121,7 +121,7 @@ describe('Deploy to ECS', () => {
121
121
test ( 'registers the task definition contents and updates the service' , async ( ) => {
122
122
await run ( ) ;
123
123
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
124
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
124
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
125
125
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
126
126
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
127
127
cluster : 'cluster-789' ,
@@ -134,7 +134,7 @@ describe('Deploy to ECS', () => {
134
134
forceNewDeployment : false
135
135
} ) ;
136
136
expect ( waitUntilServicesStable ) . toHaveBeenCalledTimes ( 0 ) ;
137
- expect ( core . info ) . toBeCalledWith ( "Deployment started. Watch this deployment's progress in the Amazon ECS console: https://console.aws.amazon.com/ecs/home?region=fake-region# /clusters/cluster-789/services/service-456/events" ) ;
137
+ expect ( core . info ) . toBeCalledWith ( "Deployment started. Watch this deployment's progress in the Amazon ECS console: https://fake-region. console.aws.amazon.com/ecs/v2 /clusters/cluster-789/services/service-456/events?region=fake-region " ) ;
138
138
} ) ;
139
139
140
140
test ( 'registers the task definition contents and updates the service if deployment controller type is ECS' , async ( ) => {
@@ -152,7 +152,7 @@ describe('Deploy to ECS', () => {
152
152
153
153
await run ( ) ;
154
154
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
155
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
155
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
156
156
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
157
157
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
158
158
cluster : 'cluster-789' ,
@@ -165,15 +165,15 @@ describe('Deploy to ECS', () => {
165
165
forceNewDeployment : false
166
166
} ) ;
167
167
expect ( waitUntilServicesStable ) . toHaveBeenCalledTimes ( 0 ) ;
168
- expect ( core . info ) . toBeCalledWith ( "Deployment started. Watch this deployment's progress in the Amazon ECS console: https://console.aws.amazon.com/ecs/home?region=fake-region# /clusters/cluster-789/services/service-456/events" ) ;
168
+ expect ( core . info ) . toBeCalledWith ( "Deployment started. Watch this deployment's progress in the Amazon ECS console: https://fake-region. console.aws.amazon.com/ecs/v2 /clusters/cluster-789/services/service-456/events?region=fake-region " ) ;
169
169
} ) ;
170
170
171
171
test ( 'prints Chinese console domain for cn regions' , async ( ) => {
172
172
const originalRegion = config . region ;
173
173
config . region = ( ) => Promise . resolve ( 'cn-fake-region' ) ;
174
174
await run ( ) ;
175
175
176
- expect ( core . info ) . toBeCalledWith ( "Deployment started. Watch this deployment's progress in the Amazon ECS console: https://console.amazonaws.cn/ecs/home?region=cn-fake-region# /clusters/cluster-789/services/service-456/events" ) ;
176
+ expect ( core . info ) . toBeCalledWith ( "Deployment started. Watch this deployment's progress in the Amazon ECS console: https://cn-fake-region. console.amazonaws.cn/ecs/v2 /clusters/cluster-789/services/service-456/events?region=cn-fake-region " ) ;
177
177
178
178
// reset
179
179
config . region = originalRegion ;
@@ -190,7 +190,7 @@ describe('Deploy to ECS', () => {
190
190
191
191
await run ( ) ;
192
192
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
193
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
193
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
194
194
} ) ;
195
195
196
196
test ( 'cleans empty arrays out of the task definition contents' , async ( ) => {
@@ -204,7 +204,7 @@ describe('Deploy to ECS', () => {
204
204
205
205
await run ( ) ;
206
206
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
207
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
207
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
208
208
} ) ;
209
209
210
210
test ( 'cleans empty strings and objects out of the task definition contents' , async ( ) => {
@@ -269,7 +269,7 @@ describe('Deploy to ECS', () => {
269
269
} ]
270
270
}
271
271
] ,
272
- requiresCompatibilities : [ 'EC2' ]
272
+ requiresCompatibilities : [ 'EC2' ]
273
273
} ) ;
274
274
} ) ;
275
275
@@ -365,7 +365,7 @@ describe('Deploy to ECS', () => {
365
365
} ]
366
366
}
367
367
] ,
368
- requiresCompatibilities : [ 'EC2' ] ,
368
+ requiresCompatibilities : [ 'EC2' ] ,
369
369
proxyConfiguration : {
370
370
type : "APPMESH" ,
371
371
containerName : "envoy" ,
@@ -418,7 +418,7 @@ describe('Deploy to ECS', () => {
418
418
419
419
await run ( ) ;
420
420
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
421
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
421
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
422
422
} ) ;
423
423
424
424
test ( 'registers the task definition contents and creates a CodeDeploy deployment, waits for 30 minutes + deployment group wait time' , async ( ) => {
@@ -444,7 +444,7 @@ describe('Deploy to ECS', () => {
444
444
await run ( ) ;
445
445
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
446
446
447
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
447
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
448
448
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
449
449
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
450
450
cluster : 'cluster-789' ,
@@ -457,21 +457,21 @@ describe('Deploy to ECS', () => {
457
457
revision : {
458
458
revisionType : 'AppSpecContent' ,
459
459
appSpecContent : {
460
- content : JSON . stringify ( {
461
- Resources : [ {
462
- TargetService : {
463
- Type : 'AWS::ECS::Service' ,
464
- Properties : {
465
- TaskDefinition : 'task:def:arn' ,
466
- LoadBalancerInfo : {
467
- ContainerName : "web" ,
468
- ContainerPort : 80
460
+ content : JSON . stringify ( {
461
+ Resources : [ {
462
+ TargetService : {
463
+ Type : 'AWS::ECS::Service' ,
464
+ Properties : {
465
+ TaskDefinition : 'task:def:arn' ,
466
+ LoadBalancerInfo : {
467
+ ContainerName : "web" ,
468
+ ContainerPort : 80
469
+ }
469
470
}
470
- }
471
- }
472
- } ]
471
+ }
472
+ } ]
473
473
} ) ,
474
- sha256 : '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
474
+ sha256 : '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
475
475
}
476
476
}
477
477
} ) ;
@@ -522,7 +522,7 @@ describe('Deploy to ECS', () => {
522
522
await run ( ) ;
523
523
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
524
524
525
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
525
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
526
526
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
527
527
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
528
528
cluster : 'cluster-789' ,
@@ -535,21 +535,21 @@ describe('Deploy to ECS', () => {
535
535
revision : {
536
536
revisionType : 'AppSpecContent' ,
537
537
appSpecContent : {
538
- content : JSON . stringify ( {
539
- Resources : [ {
540
- TargetService : {
541
- Type : 'AWS::ECS::Service' ,
542
- Properties : {
543
- TaskDefinition : 'task:def:arn' ,
544
- LoadBalancerInfo : {
545
- ContainerName : "web" ,
546
- ContainerPort : 80
538
+ content : JSON . stringify ( {
539
+ Resources : [ {
540
+ TargetService : {
541
+ Type : 'AWS::ECS::Service' ,
542
+ Properties : {
543
+ TaskDefinition : 'task:def:arn' ,
544
+ LoadBalancerInfo : {
545
+ ContainerName : "web" ,
546
+ ContainerPort : 80
547
+ }
547
548
}
548
- }
549
- }
550
- } ]
549
+ }
550
+ } ]
551
551
} ) ,
552
- sha256 : '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
552
+ sha256 : '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
553
553
}
554
554
}
555
555
} ) ;
@@ -598,7 +598,7 @@ describe('Deploy to ECS', () => {
598
598
await run ( ) ;
599
599
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
600
600
601
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
601
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
602
602
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
603
603
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
604
604
cluster : 'cluster-789' ,
@@ -611,21 +611,21 @@ describe('Deploy to ECS', () => {
611
611
revision : {
612
612
revisionType : 'AppSpecContent' ,
613
613
appSpecContent : {
614
- content : JSON . stringify ( {
615
- Resources : [ {
616
- TargetService : {
617
- Type : 'AWS::ECS::Service' ,
618
- Properties : {
619
- TaskDefinition : 'task:def:arn' ,
620
- LoadBalancerInfo : {
621
- ContainerName : "web" ,
622
- ContainerPort : 80
614
+ content : JSON . stringify ( {
615
+ Resources : [ {
616
+ TargetService : {
617
+ Type : 'AWS::ECS::Service' ,
618
+ Properties : {
619
+ TaskDefinition : 'task:def:arn' ,
620
+ LoadBalancerInfo : {
621
+ ContainerName : "web" ,
622
+ ContainerPort : 80
623
+ }
623
624
}
624
- }
625
- }
626
- } ]
625
+ }
626
+ } ]
627
627
} ) ,
628
- sha256 : '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
628
+ sha256 : '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
629
629
}
630
630
}
631
631
} ) ;
@@ -726,7 +726,7 @@ describe('Deploy to ECS', () => {
726
726
await run ( ) ;
727
727
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
728
728
729
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
729
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
730
730
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
731
731
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
732
732
cluster : 'cluster-789' ,
@@ -739,21 +739,21 @@ describe('Deploy to ECS', () => {
739
739
revision : {
740
740
revisionType : 'AppSpecContent' ,
741
741
appSpecContent : {
742
- content : JSON . stringify ( {
743
- Resources : [ {
744
- TargetService : {
745
- Type : 'AWS::ECS::Service' ,
746
- Properties : {
747
- TaskDefinition : 'task:def:arn' ,
748
- LoadBalancerInfo : {
749
- ContainerName : "web" ,
750
- ContainerPort : 80
742
+ content : JSON . stringify ( {
743
+ Resources : [ {
744
+ TargetService : {
745
+ Type : 'AWS::ECS::Service' ,
746
+ Properties : {
747
+ TaskDefinition : 'task:def:arn' ,
748
+ LoadBalancerInfo : {
749
+ ContainerName : "web" ,
750
+ ContainerPort : 80
751
+ }
751
752
}
752
- }
753
- }
754
- } ]
753
+ }
754
+ } ]
755
755
} ) ,
756
- sha256 : '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
756
+ sha256 : '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
757
757
}
758
758
}
759
759
} ) ;
@@ -793,7 +793,7 @@ describe('Deploy to ECS', () => {
793
793
await run ( ) ;
794
794
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
795
795
796
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
796
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
797
797
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
798
798
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
799
799
cluster : 'cluster-789' ,
@@ -866,7 +866,7 @@ describe('Deploy to ECS', () => {
866
866
await run ( ) ;
867
867
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
868
868
869
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family-absolute-path' } ) ;
869
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family-absolute-path' } ) ;
870
870
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
871
871
} ) ;
872
872
@@ -882,7 +882,7 @@ describe('Deploy to ECS', () => {
882
882
await run ( ) ;
883
883
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
884
884
885
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
885
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
886
886
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
887
887
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
888
888
cluster : 'cluster-789' ,
@@ -921,7 +921,7 @@ describe('Deploy to ECS', () => {
921
921
await run ( ) ;
922
922
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
923
923
924
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
924
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
925
925
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
926
926
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
927
927
cluster : 'cluster-789' ,
@@ -960,7 +960,7 @@ describe('Deploy to ECS', () => {
960
960
await run ( ) ;
961
961
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
962
962
963
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
963
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
964
964
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
965
965
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
966
966
cluster : 'cluster-789' ,
@@ -1000,7 +1000,7 @@ describe('Deploy to ECS', () => {
1000
1000
await run ( ) ;
1001
1001
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
1002
1002
1003
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
1003
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
1004
1004
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
1005
1005
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
1006
1006
cluster : 'cluster-789' ,
@@ -1025,7 +1025,7 @@ describe('Deploy to ECS', () => {
1025
1025
await run ( ) ;
1026
1026
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
1027
1027
1028
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
1028
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
1029
1029
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
1030
1030
expect ( mockEcsDescribeServices ) . toHaveBeenNthCalledWith ( 1 , {
1031
1031
cluster : 'default' ,
@@ -1047,7 +1047,7 @@ describe('Deploy to ECS', () => {
1047
1047
await run ( ) ;
1048
1048
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
1049
1049
1050
- expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
1050
+ expect ( mockEcsRegisterTaskDef ) . toHaveBeenNthCalledWith ( 1 , { family : 'task-def-family' } ) ;
1051
1051
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
1052
1052
expect ( mockEcsDescribeServices ) . toHaveBeenCalledTimes ( 0 ) ;
1053
1053
expect ( mockEcsUpdateService ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -1132,4 +1132,4 @@ describe('Deploy to ECS', () => {
1132
1132
expect ( core . setFailed ) . toHaveBeenNthCalledWith ( 1 , 'Failed to register task definition in ECS: Could not parse' ) ;
1133
1133
expect ( core . setFailed ) . toHaveBeenNthCalledWith ( 2 , 'Could not parse' ) ;
1134
1134
} ) ;
1135
- } ) ;
1135
+ } ) ;
0 commit comments