提交 19a2246f 编写于 作者: D Daniel Beck

[FIXED JENKINS-20744] Don't hold off building jobs copied from CLI

上级 d990ed58
......@@ -75,7 +75,7 @@ public class CopyJobCommand extends CLICommand {
dst = dst.substring(i + 1);
}
ig.copy(src,dst);
ig.copy(src,dst).save();
return 0;
}
}
......
......@@ -37,6 +37,12 @@ import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.MockFolder;
import static org.hamcrest.MatcherAssert.assertThat;
import static hudson.cli.CLICommandInvoker.Matcher.hasNoStandardOutput;
import static hudson.cli.CLICommandInvoker.Matcher.hasNoErrorOutput;
import static hudson.cli.CLICommandInvoker.Matcher.succeeded;
@SuppressWarnings("DM_DEFAULT_ENCODING")
public class CopyJobCommandTest {
......@@ -56,4 +62,23 @@ public class CopyJobCommandTest {
// TODO test copying from/to root, or into nonexistent folder
}
// hold off build until saved only makes sense on the UI with config screen shown after copying;
// expect the CLI copy command to leave the job buildable
@Test public void copiedJobIsBuildable() throws Exception {
FreeStyleProject p1 = j.createFreeStyleProject();
String copiedProjectName = "p2";
CLICommandInvoker.Result result = new CLICommandInvoker(j, new CopyJobCommand())
.invokeWithArgs(p1.getName(), copiedProjectName);
assertThat("Command expected to succeed; " + result.stderr() + ' ' + result.stdout(), result, succeeded());
assertThat("stdout empty", result, hasNoStandardOutput());
assertThat("stderr empty", result, hasNoErrorOutput());
FreeStyleProject p2 = (FreeStyleProject)j.jenkins.getItem(copiedProjectName);
assertNotNull(p2);
assertTrue(p2.isBuildable());
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册