Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix broken CASC_JENKINS_CONFIG_ENV support + test case
[FIX JENKINS-51283] close #203 Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
- Loading branch information
Showing
3 changed files
with
36 additions
and
5 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
27 changes: 27 additions & 0 deletions
27
src/test/java/org/jenkinsci/plugins/casc/JenkinsConfigTest.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,27 @@ | ||
package org.jenkinsci.plugins.casc; | ||
|
||
import jenkins.model.Jenkins; | ||
import org.jenkinsci.plugins.casc.misc.EnvVarsRule; | ||
import org.jenkinsci.plugins.casc.misc.JenkinsConfiguredWithCodeRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.RuleChain; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a> | ||
*/ | ||
public class JenkinsConfigTest { | ||
|
||
@Rule | ||
public RuleChain chain = RuleChain.outerRule( new EnvVarsRule() | ||
.env("CASC_JENKINS_CONFIG", getClass().getResource("JenkinsConfigTest.yml").toExternalForm())) | ||
.around(new JenkinsConfiguredWithCodeRule()); | ||
|
||
|
||
@Test | ||
public void loadFromCASC_JENKINS_CONFIG() { | ||
assertEquals("configuration as code - JenkinsConfigTest", Jenkins.getInstance().getSystemMessage()); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/test/resources/org/jenkinsci/plugins/casc/JenkinsConfigTest.yml
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,2 @@ | ||
jenkins: | ||
systemMessage: "configuration as code - JenkinsConfigTest" |