diff --git a/src/test/java/org/jenkinsci/plugins/casc/GitToolInstallationTest.java b/src/test/java/org/jenkinsci/plugins/casc/GitToolInstallationTest.java new file mode 100644 index 00000000..8cc0bc5e --- /dev/null +++ b/src/test/java/org/jenkinsci/plugins/casc/GitToolInstallationTest.java @@ -0,0 +1,30 @@ +package org.jenkinsci.plugins.casc; + +import hudson.plugins.git.GitTool; +import jenkins.model.Jenkins; +import org.junit.Rule; +import org.junit.Test; +import org.jvnet.hudson.test.JenkinsRule; + +import static org.junit.Assert.assertEquals; + +/** + * @author Nicolas De Loof + */ +public class GitToolInstallationTest { + + + @Rule + public JenkinsRule j = new JenkinsRule(); + + @Test + public void set_git_installations() throws Exception { + ConfigurationAsCode.configure(getClass().getResourceAsStream("GitToolInstallationTest.yml")); + + final Jenkins jenkins = Jenkins.getInstance(); + final GitTool.DescriptorImpl descriptor = (GitTool.DescriptorImpl) jenkins.getDescriptor(GitTool.class); + assertEquals(2, descriptor.getInstallations().length); + assertEquals("/usr/local/bin/git", descriptor.getInstallation("another_git").getGitExe()); + assertEquals("/bin/git", descriptor.getInstallation("git").getGitExe()); + } +} diff --git a/src/test/resources/org/jenkinsci/plugins/casc/GitToolInstallationTest.yml b/src/test/resources/org/jenkinsci/plugins/casc/GitToolInstallationTest.yml new file mode 100644 index 00000000..8328077a --- /dev/null +++ b/src/test/resources/org/jenkinsci/plugins/casc/GitToolInstallationTest.yml @@ -0,0 +1,8 @@ + +git: + installations: + - name: git + home: /bin/git + - name: another_git + home: /usr/local/bin/git +