Skip to content

Commit

Permalink
[JENKINS-31067] Added a test
Browse files Browse the repository at this point in the history
  • Loading branch information
recena committed Oct 23, 2015
1 parent bc59039 commit 05f1b86
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/test/java/hudson/scm/SubversionEnvVarsTest.java
@@ -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());
}
}

0 comments on commit 05f1b86

Please sign in to comment.