|
16 | 16 |
|
17 | 17 | package com.netflix.spinnaker.orca.front50.tasks
|
18 | 18 |
|
19 |
| - |
20 | 19 | import com.netflix.spinnaker.orca.api.pipeline.ExecutionPreprocessor
|
21 | 20 | import com.netflix.spinnaker.orca.front50.DependentPipelineStarter
|
22 | 21 | import com.netflix.spinnaker.orca.front50.Front50Service
|
| 22 | +import com.netflix.spinnaker.orca.pipeline.model.StageExecutionImpl |
23 | 23 | import com.netflix.spinnaker.orca.pipeline.util.ContextParameterProcessor
|
24 | 24 | import spock.lang.Specification
|
25 | 25 | import spock.lang.Subject
|
@@ -111,4 +111,53 @@ class StartPipelineTaskSpec extends Specification {
|
111 | 111 | ) || "authenticated_user" || ["account1"]
|
112 | 112 |
|
113 | 113 | }
|
| 114 | + |
| 115 | + @Unroll |
| 116 | + def "should trigger the dependent pipeline with isolatedStreamExecution"() { |
| 117 | + given: |
| 118 | + def pipelineConfig = [id: "testStrategyId", application: "orca", name: "testStrategy", other: "other"] |
| 119 | + |
| 120 | + 1 * front50Service.getStrategies(_) >> [pipelineConfig] |
| 121 | + def stage = stage { |
| 122 | + type = "whatever" |
| 123 | + name = "testing" |
| 124 | + context = [ |
| 125 | + pipelineId : "testStrategyId", |
| 126 | + pipelineParameters : [ |
| 127 | + strategy: true, |
| 128 | + zone : "north-pole-1", |
| 129 | + ], |
| 130 | + isolatedStreamExecution: isIsolatedStreamExecution |
| 131 | + ] |
| 132 | + } |
| 133 | + |
| 134 | + stage.getExecution().getStages().add(new StageExecutionImpl(stage.getExecution(), "stage2")) |
| 135 | + stage.getExecution().getStages().add(new StageExecutionImpl(stage.getExecution(), "stage3")) |
| 136 | + def parentPipelineStageId |
| 137 | + def pipelineExecution |
| 138 | + |
| 139 | + when: |
| 140 | + def result = task.execute(stage) |
| 141 | + |
| 142 | + then: |
| 143 | + dependentPipelineStarter.trigger(*_) >> { |
| 144 | + pipelineExecution = it[2] |
| 145 | + parentPipelineStageId = it[4] |
| 146 | + |
| 147 | + return pipeline { |
| 148 | + id = "testPipelineId" |
| 149 | + application = "orca" |
| 150 | + } |
| 151 | + } |
| 152 | + |
| 153 | + parentPipelineStageId == stage.id |
| 154 | + stagesNumber == pipelineExecution.getStages().size() |
| 155 | + |
| 156 | + where: |
| 157 | + isIsolatedStreamExecution || stagesNumber |
| 158 | + false || 3 |
| 159 | + true || 1 |
| 160 | + |
| 161 | + } |
| 162 | + |
114 | 163 | }
|
0 commit comments