Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test propagation of additional downstream result types #33

Merged
merged 1 commit into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<p>
If enabled (default state), then if the downstream build is anything but successful (blue ball), this step fails.
If enabled (default state), then the result of this step is that of the downstream build (e.g.,
success, unstable, failure, not built, or aborted).
If disabled, then this step succeeds even if the downstream build is unstable, failed, etc.;
use the <code>result</code> property of the return value as needed.
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,25 @@ public void abortBuild() throws Exception {
}

@Issue("JENKINS-49073")
@Test public void downstreamUnstable() throws Exception {
FreeStyleProject ds = j.createFreeStyleProject("ds");
@Test public void downstreamResult() throws Exception {
downstreamResult(Result.SUCCESS);
downstreamResult(Result.UNSTABLE);
downstreamResult(Result.FAILURE);
downstreamResult(Result.NOT_BUILT);
downstreamResult(Result.ABORTED);
}

private void downstreamResult(Result result) throws Exception {
FreeStyleProject ds = j.createFreeStyleProject();
ds.getBuildersList().add(new TestBuilder() {
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
build.setResult(Result.UNSTABLE);
build.setResult(result);
return true;
}
});
WorkflowJob us = j.createProject(WorkflowJob.class, "us");
us.setDefinition(new CpsFlowDefinition("build 'ds'", true));
j.assertBuildStatus(Result.UNSTABLE, us.scheduleBuild2(0));
WorkflowJob us = j.createProject(WorkflowJob.class);
us.setDefinition(new CpsFlowDefinition(String.format("build '%s'", ds.getName()), true));
j.assertBuildStatus(result, us.scheduleBuild2(0));
}

@Test
Expand Down