use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.
the class AgentVcsSupportTest method short_lived_agent_auto_clone_existing_mirror.
@TestFor(issues = "TW-71416")
public void short_lived_agent_auto_clone_existing_mirror() throws Exception {
final File remote = dataFile("repo_for_shallow_fetch.git");
final VcsRootImpl root1 = createRoot(remote, "refs/heads/main");
root1.addProperty(Constants.CHECKOUT_POLICY, AgentCheckoutPolicy.USE_MIRRORS.name());
myVcsSupport.updateSources(root1, new CheckoutRules(""), "64195c330d99c467a142f682bc23d4de3a68551d", myTempFiles.createTempDir(), myBuild, false);
final File mirror = myBuilder.getMirrorManager().getMirrorDir(GitUtils.toURL(remote));
// mirror initialized
assertFalse(FileUtil.isEmptyDir(mirror));
myBuild.getAgentConfiguration().addConfigurationParameter(AgentMiscConstants.IS_EPHEMERAL_AGENT_PROP, "true");
final File testFile = new File(myCheckoutDir, "test_file");
final File shallowMarker = new File(myCheckoutDir, ".git/shallow");
final VcsRootImpl root2 = createRoot(remote, "refs/heads/main");
root2.addProperty(Constants.CHECKOUT_POLICY, AgentCheckoutPolicy.AUTO.name());
myVcsSupport.updateSources(root2, new CheckoutRules(""), "64195c330d99c467a142f682bc23d4de3a68551d", myCheckoutDir, myBuild, false);
assertFalse(shallowMarker.exists());
}
use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.
the class AgentVcsSupportTest method testDotInSubmoduleBranch.
@TestFor(issues = "TW-72198")
public void testDotInSubmoduleBranch() throws Exception {
myRoot.addProperty(Constants.BRANCH_NAME, "TW-72198");
myRoot.addProperty(Constants.SUBMODULES_CHECKOUT, SubmodulesCheckoutPolicy.CHECKOUT.name());
myVcsSupport.updateSources(myRoot, new CheckoutRules(""), "fd704a963d073ae4a2284eb03699433e48792747", myCheckoutDir, myBuild, false);
final File file = new File(myCheckoutDir, "submodule" + File.separator + "f.txt");
assertTrue(file.exists());
assertEquals("TW-72198", FileUtil.readText(file, "UTF-8").trim());
}
use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.
the class AgentVcsSupportTest method delete_url_insteadOf_from_config_when_switching_from_mirrors_to_alternates.
@TestFor(issues = "TW-67736")
public void delete_url_insteadOf_from_config_when_switching_from_mirrors_to_alternates() throws Exception {
final GitVcsRoot root = new AgentGitVcsRoot(myBuilder.getMirrorManager(), myRoot, myTookenStorage);
{
final AgentRunningBuild build = createRunningBuild(map(PluginConfigImpl.USE_MIRRORS, "true"));
myVcsSupport.updateSources(root.getOriginalRoot(), new CheckoutRules(""), GitVcsSupportTest.VERSION_TEST_HEAD, myCheckoutDir, build, false);
}
final File gitConfigFile = new File(myCheckoutDir, ".git" + File.separator + "config");
then(FileUtil.loadTextAndClose(new FileReader(gitConfigFile))).contains("insteadOf");
{
final AgentRunningBuild build = createRunningBuild(map(PluginConfigImpl.USE_ALTERNATES, "true"));
myVcsSupport.updateSources(myRoot, new CheckoutRules(""), GitVcsSupportTest.VERSION_TEST_HEAD, myCheckoutDir, build, false);
}
then(FileUtil.loadTextAndClose(new FileReader(gitConfigFile))).doesNotContain("insteadOf");
}
use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.
the class AgentVcsSupportTest method testRespectSubmoduleBranch.
@TestFor(issues = "TW-71691")
public void testRespectSubmoduleBranch() throws Exception {
myRoot.addProperty(Constants.BRANCH_NAME, "TW-71691");
myRoot.addProperty(Constants.SUBMODULES_CHECKOUT, SubmodulesCheckoutPolicy.CHECKOUT.name());
myVcsSupport.updateSources(myRoot, new CheckoutRules(""), "058ad5872851a5e8c6b8a665d4e058b21fed27df", myCheckoutDir, myBuild, false);
final File file = new File(myCheckoutDir, "submodule" + File.separator + "f.txt");
assertTrue(file.exists());
assertEquals("TW-71691", FileUtil.readText(file, "UTF-8").trim());
}
use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.
the class AgentVcsSupportTest method should_do_fetch_if_ref_is_outdated.
@Test(dataProvider = "mirrors")
public void should_do_fetch_if_ref_is_outdated(Boolean useMirrors) throws Exception {
AgentRunningBuild build = createRunningBuild(useMirrors);
final File remote = myTempFiles.createTempDir();
copyRepository(dataFile("repo_for_fetch.2.personal"), remote);
VcsRootImpl masterRoot = createRoot(remote, "master");
VcsRootImpl personalRoot = createRoot(remote, "personal");
myVcsSupport.updateSources(personalRoot, new CheckoutRules(""), "d47dda159b27b9a8c4cee4ce98e4435eb5b17168@1303829462000", myCheckoutDir, build, false);
myVcsSupport.updateSources(masterRoot, new CheckoutRules(""), "add81050184d3c818560bdd8839f50024c188586@1303829295000", myCheckoutDir, build, false);
FileUtil.delete(remote);
copyRepository(dataFile("repo_for_fetch.2"), remote);
myVcsSupport.updateSources(masterRoot, new CheckoutRules(""), "d47dda159b27b9a8c4cee4ce98e4435eb5b17168@1303829462000", myCheckoutDir, build, false);
}
Aggregations