Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from recena/JENKINS-31067
[JENKINS-31067] Global env vars are not available on SVN Polling
- Loading branch information
Showing
2 changed files
with
79 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package hudson.scm; | ||
|
||
import hudson.model.FreeStyleProject; | ||
import hudson.model.TaskListener; | ||
import hudson.slaves.EnvironmentVariablesNodeProperty; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.Issue; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
|
||
public class SubversionEnvVarsTest { | ||
|
||
public static String REPO_URL = "https://svn.jenkins-ci.org/${BRANCH}/jenkins/test-projects/model-maven-project"; | ||
|
||
@Rule | ||
public JenkinsRule jenkins = new JenkinsRule(); | ||
|
||
/** | ||
* This test aims to verify that the environment variables (from Global Properties section) are available in SCM | ||
* Polling. | ||
*/ | ||
@Issue("JENKINS-31067") | ||
@Test | ||
public void pollingWithEnvVars() throws Exception { | ||
jenkins.getInstance().getGlobalNodeProperties().add(new EnvironmentVariablesNodeProperty(new | ||
EnvironmentVariablesNodeProperty.Entry("BRANCH", "trunk"))); | ||
FreeStyleProject project = jenkins.createFreeStyleProject(); | ||
|
||
project.setScm(new SubversionSCM(REPO_URL)); | ||
jenkins.assertBuildStatusSuccess(project.scheduleBuild2(0).get()); | ||
|
||
TaskListener listener = jenkins.createTaskListener(); | ||
PollingResult poll = project.poll(listener); | ||
assertFalse(poll.hasChanges()); | ||
} | ||
} |