-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-69935] Set correct NODE_NAME on controller (#242)
- Loading branch information
1 parent
9308163
commit 25453b8
Showing
2 changed files
with
35 additions
and
1 deletion.
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
34 changes: 34 additions & 0 deletions
34
src/test/java/org/jenkinsci/plugins/envinject/service/EnvInjectVariableGetterSystemTest.java
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,34 @@ | ||
package org.jenkinsci.plugins.envinject.service; | ||
|
||
import java.util.Map; | ||
import jenkins.model.Jenkins; | ||
import org.jenkinsci.plugins.envinject.service.EnvInjectVariableGetter; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.Issue; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.hasEntry; | ||
import static org.hamcrest.Matchers.hasKey; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
/** | ||
* @author Mark Waite | ||
*/ | ||
public class EnvInjectVariableGetterSystemTest { | ||
|
||
@Rule | ||
public JenkinsRule jenkinsRule = new JenkinsRule(); | ||
|
||
@Issue("JENKINS-69795") | ||
@Test | ||
public void testSystemEnvVars() throws Exception { | ||
boolean forceOnMaster = true; | ||
Map<String, String> systemEnvVars = EnvInjectVariableGetter.getJenkinsSystemEnvVars(forceOnMaster); | ||
assertThat(systemEnvVars, hasKey("NODE_NAME")); | ||
assertThat("Wrong NODE_NAME value", systemEnvVars.get("NODE_NAME"), is(Jenkins.get().getSelfLabel().getName())); | ||
assertThat(systemEnvVars, hasKey("NODE_LABELS")); | ||
assertThat("Wrong NODE_LABELS value", systemEnvVars.get("NODE_LABELS"), is(Jenkins.get().getSelfLabel().getName())); | ||
} | ||
} |