Allows pre- and post-2.125 versions of Jenkins core to pass (#1798)

Thanks for the quick reviews.
This commit is contained in:
Karl Shultz 2018-08-23 09:53:20 -04:00 committed by GitHub
parent 23702052eb
commit 96a2bb2f9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import jenkins.plugins.git.GitSCMSource;
import jenkins.plugins.git.GitSampleRepoRule;
import jenkins.scm.api.SCMSource;
import jenkins.util.SystemProperties;
import static org.hamcrest.Matchers.*;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
@ -296,7 +297,14 @@ public class AbstractRunImplTest extends PipelineBaseTest {
Assert.assertEquals("QUEUED", latestRun.get("state"));
Assert.assertEquals("1", latestRun.get("id"));
Assert.assertEquals("Jenkins doesnt have label test", latestRun.get("causeOfBlockage"));
// Jenkins 2.125 introduced quotes around these labels - see commit 91ddc6. This came
// just after the current Jenkins LTS, which is version 2.121.1. So this assert now
// tests for the new quoted version, and the old non-quoted version.
Assert.assertThat((String)latestRun.get("causeOfBlockage"), anyOf(
equalTo("\u2018Jenkins\u2019 doesnt have label \u2018test\u2019"),
equalTo("Jenkins doesnt have label test")
));
j.createOnlineSlave(Label.get("test"));