-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(disable): skip disabled check for partially disabled server groups (
#4000) * fix(disable): skip disabled check for partially disabled server groups Rolling red black and monitored deployments create disable server group stages with a desiredPercentage, which only disables some instances and not the whole server group. In that case, we need to skip the check that the server group is disabled. * fixup! fix(disable): skip disabled check for partially disabled server groups * fixup! fixup! fix(disable): skip disabled check for partially disabled server groups * fixup! fixup! fixup! fix(disable): skip disabled check for partially disabled server groups * fixup! fixup! fixup! fixup! fix(disable): skip disabled check for partially disabled server groups
- Loading branch information
Showing
2 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ix/spinnaker/orca/clouddriver/tasks/servergroup/WaitForDisabledServerGroupTaskSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.netflix.spinnaker.orca.clouddriver.tasks.servergroup | ||
|
||
import com.netflix.spinnaker.orca.api.pipeline.TaskResult | ||
import com.netflix.spinnaker.orca.api.pipeline.models.PipelineExecution | ||
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution | ||
import com.netflix.spinnaker.orca.pipeline.StageExecutionFactory | ||
import com.netflix.spinnaker.orca.pipeline.model.PipelineExecutionImpl | ||
import com.netflix.spinnaker.orca.pipeline.model.StageExecutionImpl | ||
import spock.lang.Specification | ||
import spock.lang.Subject | ||
import spock.lang.Unroll | ||
|
||
import static com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* | ||
|
||
class WaitForDisabledServerGroupTaskSpec extends Specification { | ||
@Subject | ||
WaitForDisabledServerGroupTask task = new WaitForDisabledServerGroupTask(null, null) | ||
|
||
@Unroll | ||
def "handles wonky desiredPercentage=#desiredPercentage gracefully"() { | ||
given: | ||
StageExecution stage = StageExecutionFactory.newStage( | ||
PipelineExecutionImpl.newOrchestration("orca"), | ||
"stageType", "stageName", | ||
[desiredPercentage: desiredPercentage], | ||
null, null) | ||
|
||
when: | ||
def taskInput = stage.mapTo(WaitForDisabledServerGroupTask.TaskInput) | ||
|
||
then: | ||
taskInput.desiredPercentage == mapsTo | ||
|
||
when: | ||
def taskResult = task.execute(stage) | ||
|
||
then: | ||
stage.context.desiredPercentage == desiredPercentage | ||
taskResult.status == expected | ||
|
||
where: | ||
desiredPercentage | mapsTo || expected | ||
null | null || SKIPPED | ||
-1 | -1 || SKIPPED | ||
"" | null || SKIPPED | ||
new Integer(100) | 100 || SKIPPED | ||
"200" | 200 || SKIPPED | ||
102.5 | 102 || SKIPPED | ||
// 1L << 33, Jackson throws "Numeric value (8589934592) out of range of int" | ||
} | ||
} |