Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged #91: [FIXED JENKINS-23571] Add configuration option for cache …
…directory location
- Loading branch information
Showing
8 changed files
with
116 additions
and
21 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
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
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
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
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
4 changes: 4 additions & 0 deletions
4
src/main/resources/hudson/plugins/mercurial/MercurialInstallation/help-masterCacheRoot.html
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,4 @@ | ||
<div> | ||
Location of cached repositories on the master node. | ||
Default : $JENKINS_HOME/hgcache | ||
</div> |
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
52 changes: 52 additions & 0 deletions
52
src/test/java/hudson/plugins/mercurial/CachingCustomDirSCMTest.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,52 @@ | ||
package hudson.plugins.mercurial; | ||
|
||
import java.io.File; | ||
import java.util.Collections; | ||
import java.util.regex.Pattern; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import hudson.model.FreeStyleProject; | ||
import hudson.tools.ToolProperty; | ||
|
||
public class CachingCustomDirSCMTest { | ||
|
||
@Rule | ||
public JenkinsRule j = new JenkinsRule(); | ||
@Rule | ||
public MercurialRule m = new MercurialRule(j); | ||
@Rule | ||
public TemporaryFolder tmp = new TemporaryFolder(); | ||
private File repo; | ||
|
||
private static final String CACHING_INSTALLATION = "caching-custom-dir"; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
repo = tmp.getRoot(); | ||
j.jenkins | ||
.getDescriptorByType(MercurialInstallation.DescriptorImpl.class) | ||
.setInstallations(new MercurialInstallation(CACHING_INSTALLATION, "", "hg", | ||
false, true, new File(tmp.newFolder(),"custom-cache-dir").getAbsolutePath().toString(), false, "", | ||
Collections.<ToolProperty<?>> emptyList())); | ||
} | ||
|
||
@Test | ||
public void customCacheLocationFromSlave() throws Exception { | ||
FreeStyleProject p = j.createFreeStyleProject(); | ||
p.setScm(new MercurialSCM(CACHING_INSTALLATION, repo.getPath(), null, null, | ||
null, null, false)); | ||
p.setAssignedNode(j.createOnlineSlave()); | ||
m.hg(repo, "init"); | ||
m.touchAndCommit(repo, "a"); | ||
String log = m.buildAndCheck(p, "a"); | ||
Pattern pattern = Pattern.compile("hg clone .*custom-cache-dir"); | ||
Assert.assertTrue(pattern.matcher(log).find()); | ||
} | ||
|
||
} |