-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(titus): Lookup image form jenkins properties file (#3714)
restorting back some logic that was missed in refactor here (https://github.com/spinnaker/orca/pull/3688/files#diff-f4fd7e2fcf07f509c4f3be8808c5e76cL111-L113)
- Loading branch information
1 parent
d906fe6
commit 9d4d91f
Showing
2 changed files
with
59 additions
and
0 deletions.
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
54 changes: 54 additions & 0 deletions
54
...er/orca/clouddriver/tasks/providers/aws/TitusAmazonServerGroupCreatorDecoratorSpec.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,54 @@ | ||
/* | ||
* Copyright 2020 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.orca.clouddriver.tasks.providers.aws | ||
|
||
import com.netflix.spinnaker.orca.pipeline.model.JenkinsTrigger | ||
import spock.lang.Specification | ||
import static com.netflix.spinnaker.orca.test.model.ExecutionBuilder.pipeline | ||
import static com.netflix.spinnaker.orca.test.model.ExecutionBuilder.stage | ||
|
||
class TitusAmazonServerGroupCreatorDecoratorSpec extends Specification { | ||
def "should find image id from properties file"() { | ||
given: | ||
JenkinsTrigger jenkinsTrigger = new JenkinsTrigger("master", "job", 1, null) | ||
jenkinsTrigger.properties.put("imageName", "imageFromProperties") | ||
|
||
def pipeline = pipeline { | ||
trigger = jenkinsTrigger | ||
stage { | ||
type = "deploy" | ||
} | ||
} | ||
|
||
def stage = pipeline.stages[0] | ||
TitusAmazonServerGroupCreatorDecorator decorator = new TitusAmazonServerGroupCreatorDecorator() | ||
|
||
when: | ||
decorator.modifyCreateServerGroupOperationContext(stage, stage.context) | ||
|
||
then: | ||
stage.context.imageId == jenkinsTrigger.properties.get("imageName") | ||
|
||
when: 'trigger parameter specified' | ||
stage.context.remove("imageId") | ||
jenkinsTrigger.parameters.put("imageName", "imageFromParameters") | ||
decorator.modifyCreateServerGroupOperationContext(stage, stage.context) | ||
|
||
then: 'it takes precedence over props file' | ||
stage.context.imageId == jenkinsTrigger.parameters.get("imageName") | ||
} | ||
} |