use of org.jvnet.hudson.test.JenkinsRule.TestBuildWrapper in project promoted-builds-plugin by jenkinsci.
the class PromotionBuildWrapperTest method testApplyBuildWrapper.
@Test
public void testApplyBuildWrapper() throws Exception {
FreeStyleProject project = j.createFreeStyleProject();
JobPropertyImpl jobProperty = new JobPropertyImpl(project);
project.addProperty(jobProperty);
PromotionProcess promotion = jobProperty.addProcess("test");
TestBuildWrapper buildWrapper = new TestBuildWrapper();
promotion.getBuildWrappersList().add(buildWrapper);
promotion.getBuildSteps().add(Functions.isWindows() ? new BatchFile("echo Hello, world") : new Shell("echo Hello, world"));
// trigger build
FreeStyleBuild build = j.assertBuildStatusSuccess(project.scheduleBuild2(0).get());
// trigger promotion
promotion.promote(build, new Cause.UserIdCause(), new ManualPromotionBadge());
Thread.sleep(1000);
assertEquals(1, promotion.getBuilds().size());
Promotion promotionBuild = promotion.getBuilds().get(0);
assertSame(promotionBuild.getTargetBuildOrFail(), build);
assertEquals(Result.SUCCESS, buildWrapper.buildResultInTearDown);
}
Aggregations