@@ -687,14 +687,15 @@ describe('Deploy to ECS', () => {
687
687
core . getInput = jest
688
688
. fn ( )
689
689
. mockReturnValueOnce ( 'task-definition.json' ) // task-definition
690
- . mockReturnValueOnce ( 'service-456' ) // service
691
- . mockReturnValueOnce ( 'cluster-789' ) // cluster
692
- . mockReturnValueOnce ( 'false' ) // wait-for-service-stability
693
- . mockReturnValueOnce ( '' ) // wait-for-minutes
694
- . mockReturnValueOnce ( '' ) // force-new-deployment
695
- . mockReturnValueOnce ( '/hello/appspec.json' ) // codedeploy-appspec
696
- . mockReturnValueOnce ( 'MyApplication' ) // codedeploy-application
697
- . mockReturnValueOnce ( 'MyDeploymentGroup' ) ; // codedeploy-deployment-group
690
+ . mockReturnValueOnce ( 'service-456' ) // service
691
+ . mockReturnValueOnce ( 'cluster-789' ) // cluster
692
+ . mockReturnValueOnce ( 'false' ) // wait-for-service-stability
693
+ . mockReturnValueOnce ( '' ) // wait-for-minutes
694
+ . mockReturnValueOnce ( '' ) // force-new-deployment
695
+ . mockReturnValueOnce ( '' ) // desired count
696
+ . mockReturnValueOnce ( '/hello/appspec.json' ) // codedeploy-appspec
697
+ . mockReturnValueOnce ( 'MyApplication' ) // codedeploy-application
698
+ . mockReturnValueOnce ( 'MyDeploymentGroup' ) // codedeploy-deployment-group
698
699
699
700
fs . readFileSync . mockReturnValue ( `
700
701
{
@@ -887,7 +888,7 @@ describe('Deploy to ECS', () => {
887
888
expect ( core . info ) . toBeCalledWith ( "Deployment started. Watch this deployment's progress in the AWS CodeDeploy console: https://console.aws.amazon.com/codesuite/codedeploy/deployments/deployment-1?region=fake-region" ) ;
888
889
} ) ;
889
890
890
- test ( 'registers the task definition contents at an absolute path' , async ( ) => {
891
+ test ( 'registers the task definition contents at an absolute path' , async ( ) => {
891
892
core . getInput = jest . fn ( ) . mockReturnValueOnce ( '/hello/task-definition.json' ) ;
892
893
fs . readFileSync . mockImplementation ( ( pathInput , encoding ) => {
893
894
if ( encoding != 'utf8' ) {
@@ -908,13 +909,14 @@ describe('Deploy to ECS', () => {
908
909
expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
909
910
} ) ;
910
911
911
- test ( 'waits for the service to be stable' , async ( ) => {
912
+ test ( 'waits for the service to be stable' , async ( ) => {
912
913
core . getInput = jest
913
914
. fn ( )
914
915
. mockReturnValueOnce ( 'task-definition.json' ) // task-definition
915
- . mockReturnValueOnce ( 'service-456' ) // service
916
- . mockReturnValueOnce ( 'cluster-789' ) // cluster
917
- . mockReturnValueOnce ( 'TRUE' ) ; // wait-for-service-stability
916
+ . mockReturnValueOnce ( 'service-456' ) // service
917
+ . mockReturnValueOnce ( 'cluster-789' ) // cluster
918
+ . mockReturnValueOnce ( 'TRUE' ) // wait-for-service-stability
919
+ . mockReturnValueOnce ( '' ) ; // desired count
918
920
919
921
await run ( ) ;
920
922
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -945,10 +947,11 @@ describe('Deploy to ECS', () => {
945
947
core . getInput = jest
946
948
. fn ( )
947
949
. mockReturnValueOnce ( 'task-definition.json' ) // task-definition
948
- . mockReturnValueOnce ( 'service-456' ) // service
949
- . mockReturnValueOnce ( 'cluster-789' ) // cluster
950
- . mockReturnValueOnce ( 'TRUE' ) // wait-for-service-stability
951
- . mockReturnValueOnce ( '60' ) ; // wait-for-minutes
950
+ . mockReturnValueOnce ( 'service-456' ) // service
951
+ . mockReturnValueOnce ( 'cluster-789' ) // cluster
952
+ . mockReturnValueOnce ( 'TRUE' ) // wait-for-service-stability
953
+ . mockReturnValueOnce ( '60' ) // wait-for-minutes
954
+ . mockReturnValueOnce ( '' ) ; // desired count
952
955
953
956
await run ( ) ;
954
957
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -979,10 +982,11 @@ describe('Deploy to ECS', () => {
979
982
core . getInput = jest
980
983
. fn ( )
981
984
. mockReturnValueOnce ( 'task-definition.json' ) // task-definition
982
- . mockReturnValueOnce ( 'service-456' ) // service
983
- . mockReturnValueOnce ( 'cluster-789' ) // cluster
984
- . mockReturnValueOnce ( 'TRUE' ) // wait-for-service-stability
985
- . mockReturnValueOnce ( '1000' ) ; // wait-for-minutes
985
+ . mockReturnValueOnce ( 'service-456' ) // service
986
+ . mockReturnValueOnce ( 'cluster-789' ) // cluster
987
+ . mockReturnValueOnce ( 'TRUE' ) // wait-for-service-stability
988
+ . mockReturnValueOnce ( '1000' ) // wait-for-minutes
989
+ . mockReturnValueOnce ( 'abc' ) ; // desired count is NaN
986
990
987
991
await run ( ) ;
988
992
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -1012,12 +1016,13 @@ describe('Deploy to ECS', () => {
1012
1016
test ( 'force new deployment' , async ( ) => {
1013
1017
core . getInput = jest
1014
1018
. fn ( )
1015
- . mockReturnValueOnce ( 'task-definition.json' ) // task-definition
1019
+ . mockReturnValueOnce ( 'task-definition.json' ) // task-definition
1016
1020
. mockReturnValueOnce ( 'service-456' ) // service
1017
1021
. mockReturnValueOnce ( 'cluster-789' ) // cluster
1018
1022
. mockReturnValueOnce ( 'false' ) // wait-for-service-stability
1019
1023
. mockReturnValueOnce ( '' ) // wait-for-minutes
1020
- . mockReturnValueOnce ( 'true' ) ; // force-new-deployment
1024
+ . mockReturnValueOnce ( 'true' ) // force-new-deployment
1025
+ . mockReturnValueOnce ( '4' ) ; // desired count is number
1021
1026
1022
1027
await run ( ) ;
1023
1028
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -1030,6 +1035,7 @@ describe('Deploy to ECS', () => {
1030
1035
} ) ;
1031
1036
expect ( mockEcsUpdateService ) . toHaveBeenNthCalledWith ( 1 , {
1032
1037
cluster : 'cluster-789' ,
1038
+ desiredCount : 4 ,
1033
1039
service : 'service-456' ,
1034
1040
taskDefinition : 'task:def:arn' ,
1035
1041
forceNewDeployment : true
@@ -1040,7 +1046,8 @@ describe('Deploy to ECS', () => {
1040
1046
core . getInput = jest
1041
1047
. fn ( )
1042
1048
. mockReturnValueOnce ( 'task-definition.json' ) // task-definition
1043
- . mockReturnValueOnce ( 'service-456' ) ; // service
1049
+ . mockReturnValueOnce ( 'service-456' ) // service
1050
+ . mockReturnValueOnce ( '' ) ; // desired count
1044
1051
1045
1052
await run ( ) ;
1046
1053
expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
0 commit comments