@@ -16,11 +16,12 @@ var _ = Describe("Deployment Strategy", func() {
1616 const keepOriginalNamesAfterDeploy = "keepOriginalAppNamesAfterDeploy"
1717 const skipIdleStart = "skipIdleStart"
1818 const shouldBackupPreviousVersion = "shouldBackupPreviousVersion"
19+ const dependencyAwareStopOrderOpt = "stopOrderIsDependencyAware"
1920
2021 var deployProcessTypeProvider = & fakes.FakeDeployCommandProcessTypeProvider {}
2122 var bgDeployProcessTypeProvider = & fakes.FakeBlueGreenCommandProcessTypeProvider {}
2223
23- var createFlags = func (noConfirm bool , skipIdleStart bool , strategy string , backupPreviousVersion bool ) * flag.FlagSet {
24+ var createFlags = func (noConfirm bool , skipIdleStart bool , strategy string , backupPreviousVersion bool , dependencyAwareStopOption bool ) * flag.FlagSet {
2425 flags := flag .NewFlagSet ("" , flag .ContinueOnError )
2526 flags .SetOutput (io .Discard )
2627
@@ -29,11 +30,12 @@ var _ = Describe("Deployment Strategy", func() {
2930 flags .Bool ("skip-testing-phase" , true , "" )
3031 flags .Bool ("skip-idle-start" , skipIdleStart , "" )
3132 flags .Bool ("backup-previous-version" , backupPreviousVersion , "" )
33+ flags .Bool ("dependency-aware-stop-order" , dependencyAwareStopOption , "" )
3234 return flags
3335 }
3436
3537 var testInputAndOperationProcessTypesMatch = func (provider commands.ProcessTypeProvider ) {
36- flags := createFlags (false , false , "default" , false )
38+ flags := createFlags (false , false , "default" , false , false )
3739 processBuilder := commands .NewDeploymentStrategy (flags , provider ).CreateProcessBuilder ()
3840 operation := processBuilder .Build ()
3941 Expect (operation .ProcessType ).To (Equal (provider .GetProcessType ()))
@@ -47,7 +49,7 @@ var _ = Describe("Deployment Strategy", func() {
4749
4850 Context ("with a blue-green deploy command and --no-confirm flag" , func () {
4951 It ("should build a blue-green deploy operation with the noConfirm parameter set to true" , func () {
50- flags := createFlags (true , false , "default" , false )
52+ flags := createFlags (true , false , "default" , false , false )
5153
5254 processBuilder := commands .NewDeploymentStrategy (flags , bgDeployProcessTypeProvider ).CreateProcessBuilder ()
5355 operation := processBuilder .Build ()
@@ -58,7 +60,7 @@ var _ = Describe("Deployment Strategy", func() {
5860
5961 Context ("with a blue-green deploy command and --skip-idle-start flag" , func () {
6062 It ("should build a blue-green deploy operation with the skipIdleStart parameter set to true" , func () {
61- flags := createFlags (false , true , "default" , false )
63+ flags := createFlags (false , true , "default" , false , false )
6264
6365 processBuilder := commands .NewDeploymentStrategy (flags , bgDeployProcessTypeProvider ).CreateProcessBuilder ()
6466 operation := processBuilder .Build ()
@@ -75,7 +77,7 @@ var _ = Describe("Deployment Strategy", func() {
7577
7678 Context ("with a deploy command with strategy flag set to blue-green" , func () {
7779 It ("should build a blue-green deploy operation" , func () {
78- flags := createFlags (false , false , "blue-green" , false )
80+ flags := createFlags (false , false , "blue-green" , false , false )
7981
8082 processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
8183 operation := processBuilder .Build ()
@@ -87,7 +89,7 @@ var _ = Describe("Deployment Strategy", func() {
8789
8890 Context ("with a deploy command with strategy flag set to blue-green and --no-confirm flag present" , func () {
8991 It ("should build a blue-green deploy operation with the noConfirm parameter set to true" , func () {
90- flags := createFlags (true , false , "blue-green" , false )
92+ flags := createFlags (true , false , "blue-green" , false , false )
9193
9294 processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
9395 operation := processBuilder .Build ()
@@ -100,7 +102,7 @@ var _ = Describe("Deployment Strategy", func() {
100102
101103 Context ("with a deploy command with strategy flag set to blue-green and skip-idl-start set to true" , func () {
102104 It ("should build a blue-green deploy operation" , func () {
103- flags := createFlags (false , true , "blue-green" , false )
105+ flags := createFlags (false , true , "blue-green" , false , false )
104106
105107 processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
106108 operation := processBuilder .Build ()
@@ -113,7 +115,7 @@ var _ = Describe("Deployment Strategy", func() {
113115
114116 Context ("with a deploy command with strategy flag set to blue-green and backup-previous-version set to true" , func () {
115117 It ("should build a blue-green deploy operation with set backup-previous-version flag" , func () {
116- flags := createFlags (true , false , "blue-green" , true )
118+ flags := createFlags (true , false , "blue-green" , true , false )
117119
118120 processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
119121 operation := processBuilder .Build ()
@@ -125,7 +127,7 @@ var _ = Describe("Deployment Strategy", func() {
125127
126128 Context ("with a deploy command with strategy flag set to incremental-blue-green and backup-previous-version set to true" , func () {
127129 It ("should build a blue-green deploy operation with set incremental-blue-green to true and backup-previous-version to true" , func () {
128- flags := createFlags (true , false , "incremental-blue-green" , true )
130+ flags := createFlags (true , false , "incremental-blue-green" , true , false )
129131
130132 processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
131133 operation := processBuilder .Build ()
@@ -138,7 +140,7 @@ var _ = Describe("Deployment Strategy", func() {
138140
139141 Context ("with a deploy command with default strategy flag and backup-previous-version flag" , func () {
140142 It ("should build a deploy operation without backup-previous-version flag" , func () {
141- flags := createFlags (false , false , "default" , true )
143+ flags := createFlags (false , false , "default" , true , false )
142144
143145 processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
144146 operation := processBuilder .Build ()
@@ -147,4 +149,41 @@ var _ = Describe("Deployment Strategy", func() {
147149 Expect (operation .Parameters ).NotTo (HaveKey (shouldBackupPreviousVersion ))
148150 })
149151 })
152+
153+ Context ("with a deploy command with blue-green strategy flag and dependency-aware-stop-order flag set to true" , func () {
154+ It ("should build a blue-green deploy operation with the dependency-aware-stop-order parameter set to true" , func () {
155+ flags := createFlags (false , false , "blue-green" , true , true )
156+
157+ processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
158+ operation := processBuilder .Build ()
159+
160+ Expect (operation .ProcessType ).To (Equal (bgDeployProcessTypeProvider .GetProcessType ()))
161+ Expect (operation .Parameters [dependencyAwareStopOrderOpt ]).To (Equal (strconv .FormatBool (true )))
162+ })
163+ })
164+
165+ Context ("with a deploy command with strategy flag set to incremental-blue-green and dependency-aware-stop-order set to true" , func () {
166+ It ("should build a blue-green deploy operation with set incremental-blue-green to true and dependency-aware-stop-order to true" , func () {
167+ flags := createFlags (false , false , "incremental-blue-green" , true , true )
168+
169+ processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
170+ operation := processBuilder .Build ()
171+
172+ Expect (operation .ProcessType ).To (Equal (bgDeployProcessTypeProvider .GetProcessType ()))
173+ Expect (operation .Parameters [dependencyAwareStopOrderOpt ]).To (Equal (strconv .FormatBool (true )))
174+ Expect (operation .Parameters ["shouldApplyIncrementalInstancesUpdate" ]).To (Equal (strconv .FormatBool (true )))
175+ })
176+ })
177+
178+ Context ("with a deploy command with default strategy flag and dependency-aware-stop-order flag" , func () {
179+ It ("should build a deploy operation without dependency-aware-stop-order flag" , func () {
180+ flags := createFlags (false , false , "default" , true , true )
181+
182+ processBuilder := commands .NewDeploymentStrategy (flags , deployProcessTypeProvider ).CreateProcessBuilder ()
183+ operation := processBuilder .Build ()
184+
185+ Expect (operation .ProcessType ).To (Equal (deployProcessTypeProvider .GetProcessType ()))
186+ Expect (operation .Parameters ).NotTo (HaveKey (dependencyAwareStopOrderOpt ))
187+ })
188+ })
150189})
0 commit comments