@Issue("JENKINS-45455")
@Test
public void sameJenkinsfileNonMultibranch() throws Exception {
WorkflowRun original = expect(Result.FAILURE, "restart", "sameJenkinsfileNonMultibranch").go();
WorkflowJob p = original.getParent();
sampleRepo.write("Jenkinsfile", pipelineSourceFromResources("restart/sameJenkinsfileNonMultibranchSecond"));
sampleRepo.write("newFile", "exists");
sampleRepo.git("add", "Jenkinsfile");
sampleRepo.git("add", "newFile");
sampleRepo.git("commit", "--message=later");
HtmlPage redirect = restartFromStageInUI(original, "restart");
assertNotNull(redirect);
assertEquals(p.getAbsoluteUrl(), redirect.getUrl().toString());
j.waitUntilNoActivity();
WorkflowRun b2 = p.getBuildByNumber(2);
assertNotNull(b2);
j.assertBuildStatusSuccess(b2);
j.assertLogContains("Even numbered build, success", b2);
j.assertLogContains("Stage \"skip-on-restart\" skipped due to this build restarting at stage \"restart\"", b2);
j.assertLogNotContains("Now we're post-restart", b2);
j.assertLogNotContains("hello on non-restart", b2);
j.assertLogContains("Stage \"post-restart\" skipped due to when conditional", b2);
}