Skip to content

Commit

Permalink
[JENKINS-46064] Add json roundtrip tests for the new when conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
rsandell committed Aug 17, 2017
1 parent 86d1115 commit f1614bc
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 2 deletions.
Expand Up @@ -162,7 +162,9 @@ public void setUp() throws Exception {
"usernamePassword",
"environmentCrossReferences",
"nestedParallelStages",
"stagePost"
"stagePost",
"when/changelog/changelog",
"when/changelog/changeset"
);

public static Iterable<Object[]> configsWithErrors() {
Expand Down
Expand Up @@ -57,7 +57,7 @@ public class ExecuteConvertedTest extends AbstractModelDefTest {
@BeforeClass
public static void setUpAgentAndCreds() throws Exception {
s = j.createOnlineSlave();
s.setLabelString("some-label docker");
s.setLabelString("some-label docker here");
s.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("ONAGENT", "true")));

CredentialsStore store = CredentialsProvider.lookupStores(j.jenkins).iterator().next();
Expand Down
@@ -0,0 +1,50 @@
{"pipeline": {
"stages": [
{
"name": "One",
"branches": [ {
"name": "default",
"steps": [ {
"name": "echo",
"arguments": [ {
"key": "message",
"value": {
"isLiteral": true,
"value": "Hello"
}
}]
}]
}]
},
{
"name": "Two",
"branches": [ {
"name": "default",
"steps": [ {
"name": "script",
"arguments": [ {
"key": "scriptBlock",
"value": {
"isLiteral": true,
"value": "echo \"Dull World\""
}
}]
}]
}],
"when": {"conditions": [ {
"name": "changelog",
"arguments": {
"isLiteral": true,
"value": ".*^\\[DEPENDENCY\\] .+$"
}
}]}
}
],
"agent": {
"type": "label",
"argument": {
"isLiteral": true,
"value": "here"
}
}
}}
@@ -0,0 +1,50 @@
{"pipeline": {
"stages": [
{
"name": "One",
"branches": [ {
"name": "default",
"steps": [ {
"name": "echo",
"arguments": [ {
"key": "message",
"value": {
"isLiteral": true,
"value": "Hello"
}
}]
}]
}]
},
{
"name": "Two",
"branches": [ {
"name": "default",
"steps": [ {
"name": "script",
"arguments": [ {
"key": "scriptBlock",
"value": {
"isLiteral": true,
"value": "echo \"JS World\""
}
}]
}]
}],
"when": {"conditions": [ {
"name": "changeset",
"arguments": {
"isLiteral": true,
"value": "**/*.js"
}
}]}
}
],
"agent": {
"type": "label",
"argument": {
"isLiteral": true,
"value": "here"
}
}
}}

0 comments on commit f1614bc

Please sign in to comment.