@@ -687,14 +687,15 @@ describe('Deploy to ECS', () => {
687687 core . getInput = jest
688688 . fn ( )
689689 . 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
698699
699700 fs . readFileSync . mockReturnValue ( `
700701 {
@@ -887,7 +888,7 @@ describe('Deploy to ECS', () => {
887888 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" ) ;
888889 } ) ;
889890
890- test ( 'registers the task definition contents at an absolute path' , async ( ) => {
891+ test ( 'registers the task definition contents at an absolute path' , async ( ) => {
891892 core . getInput = jest . fn ( ) . mockReturnValueOnce ( '/hello/task-definition.json' ) ;
892893 fs . readFileSync . mockImplementation ( ( pathInput , encoding ) => {
893894 if ( encoding != 'utf8' ) {
@@ -908,13 +909,14 @@ describe('Deploy to ECS', () => {
908909 expect ( core . setOutput ) . toHaveBeenNthCalledWith ( 1 , 'task-definition-arn' , 'task:def:arn' ) ;
909910 } ) ;
910911
911- test ( 'waits for the service to be stable' , async ( ) => {
912+ test ( 'waits for the service to be stable' , async ( ) => {
912913 core . getInput = jest
913914 . fn ( )
914915 . 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
918920
919921 await run ( ) ;
920922 expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -945,10 +947,11 @@ describe('Deploy to ECS', () => {
945947 core . getInput = jest
946948 . fn ( )
947949 . 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
952955
953956 await run ( ) ;
954957 expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -979,10 +982,11 @@ describe('Deploy to ECS', () => {
979982 core . getInput = jest
980983 . fn ( )
981984 . 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
986990
987991 await run ( ) ;
988992 expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -1012,12 +1016,13 @@ describe('Deploy to ECS', () => {
10121016 test ( 'force new deployment' , async ( ) => {
10131017 core . getInput = jest
10141018 . fn ( )
1015- . mockReturnValueOnce ( 'task-definition.json' ) // task-definition
1019+ . mockReturnValueOnce ( 'task-definition.json' ) // task-definition
10161020 . mockReturnValueOnce ( 'service-456' ) // service
10171021 . mockReturnValueOnce ( 'cluster-789' ) // cluster
10181022 . mockReturnValueOnce ( 'false' ) // wait-for-service-stability
10191023 . mockReturnValueOnce ( '' ) // wait-for-minutes
1020- . mockReturnValueOnce ( 'true' ) ; // force-new-deployment
1024+ . mockReturnValueOnce ( 'true' ) // force-new-deployment
1025+ . mockReturnValueOnce ( '4' ) ; // desired count is number
10211026
10221027 await run ( ) ;
10231028 expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -1030,6 +1035,7 @@ describe('Deploy to ECS', () => {
10301035 } ) ;
10311036 expect ( mockEcsUpdateService ) . toHaveBeenNthCalledWith ( 1 , {
10321037 cluster : 'cluster-789' ,
1038+ desiredCount : 4 ,
10331039 service : 'service-456' ,
10341040 taskDefinition : 'task:def:arn' ,
10351041 forceNewDeployment : true
@@ -1040,7 +1046,8 @@ describe('Deploy to ECS', () => {
10401046 core . getInput = jest
10411047 . fn ( )
10421048 . mockReturnValueOnce ( 'task-definition.json' ) // task-definition
1043- . mockReturnValueOnce ( 'service-456' ) ; // service
1049+ . mockReturnValueOnce ( 'service-456' ) // service
1050+ . mockReturnValueOnce ( '' ) ; // desired count
10441051
10451052 await run ( ) ;
10461053 expect ( core . setFailed ) . toHaveBeenCalledTimes ( 0 ) ;
0 commit comments