Testcase for ToolInstallation support

This commit is contained in:
Nicolas De Loof 2017-11-27 19:10:47 +01:00
parent 54b3199086
commit ea33bed2aa
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
2 changed files with 38 additions and 0 deletions

View File

@ -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 <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
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());
}
}

View File

@ -0,0 +1,8 @@
git:
installations:
- name: git
home: /bin/git
- name: another_git
home: /usr/local/bin/git