Skip to content
Permalink
Browse files

[JENKINS-30785] Integration test.

  • Loading branch information...
jglick committed May 5, 2017
1 parent 1940694 commit 9eb3cbf25a4c30bc4b9e07e0079888b62ad947f0
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/test/java/org/jenkinsci/plugins/workflow/job/CLITest.java
@@ -25,6 +25,8 @@
package org.jenkinsci.plugins.workflow.job;

import hudson.cli.CLICommandInvoker;
import java.io.File;
import org.apache.commons.io.FileUtils;
import static org.hamcrest.Matchers.*;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.junit.ClassRule;
@@ -69,4 +71,18 @@
assertThat(res.stdout(), containsString("this is what I said"));
}

@Issue("JENKINS-30785")
@Test public void reload() throws Exception {
WorkflowJob p = r.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("echo 'first version'", true));
r.assertLogContains("first version", r.buildAndAssertSuccess(p));
File configXml = new File(p.getRootDir(), "config.xml");
FileUtils.write(configXml, FileUtils.readFileToString(configXml).replace("first version", "second version"));
assertThat(new CLICommandInvoker(r, "reload-job").invokeWithArgs("p"), CLICommandInvoker.Matcher.succeededSilently());
r.assertLogContains("second version", r.buildAndAssertSuccess(p));
CLICommandInvoker.Result res = new CLICommandInvoker(r, "reload-job").invokeWithArgs("q");
assertThat(res, CLICommandInvoker.Matcher.failedWith(3));
assertThat(res.stderr(), containsString("No such item ‘q’ exists. Perhaps you meant ‘p’?"));
}

}

0 comments on commit 9eb3cbf

Please sign in to comment.
You can’t perform that action at this time.