Search in sources :

Example 46 with CheckoutRules

use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.

the class GitPatchTest method excluded_broken_submodule.

@TestFor(issues = "TW-49782")
@Test(dataProvider = "patchInSeparateProcess")
public void excluded_broken_submodule(boolean patchInSeparateProcess) throws Exception {
    myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
    VcsRoot root = getRoot("reference-wrong-commit", true);
    // 7253d358a2490321a1808a1c20561b4027d69f77 references wrong submodule commit, but it is excluded by checkout rules, patch should succeed
    checkPatch(root, "excluded_broken_submodule", null, "7253d358a2490321a1808a1c20561b4027d69f77", new CheckoutRules("+:dir"));
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 47 with CheckoutRules

use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.

the class GitPatchTest method submodules_and_checkout_rules2.

@TestFor(issues = "TW-50097")
@Test(dataProvider = "patchInSeparateProcess")
public void submodules_and_checkout_rules2(boolean patchInSeparateProcess) throws Exception {
    myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
    VcsRoot root = getRoot("sub-submodule", true);
    checkPatch(root, "submodules_and_checkout_rules2", null, "ce6044093939bb47283439d97a1c80f759669ff5", new CheckoutRules("+:first-level-submodule/sub-sub"));
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 48 with CheckoutRules

use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.

the class DiffWithUpperLimitRevisionTest method no_error_if_upper_limit_revision_param_is_missing.

public void no_error_if_upper_limit_revision_param_is_missing() throws Exception {
    String version = "465ad9f630e451b9f2b782ffb09804c6a98c4bb9";
    AgentRunningBuild build = createBuild(version, null);
    myVcsSupport.updateSources(myRoot, new CheckoutRules("+:dir"), version, myCheckoutDir, build, false);
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules)

Example 49 with CheckoutRules

use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.

the class DiffWithUpperLimitRevisionTest method can_be_disabled.

public void can_be_disabled() throws Exception {
    String version = "ad4528ed5c84092fdbe9e0502163cf8d6e6141e7";
    AgentRunningBuild build = createBuild(version, "465ad9f630e451b9f2b782ffb09804c6a98c4bb9", "teamcity.git.checkDiffWithUpperLimitRevision", "false");
    myVcsSupport.updateSources(myRoot, new CheckoutRules("+:dir"), version, myCheckoutDir, build, false);
    then(myBuildLogger.getErrors()).isEmpty();
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules)

Example 50 with CheckoutRules

use of jetbrains.buildServer.vcs.CheckoutRules in project teamcity-git by JetBrains.

the class AutoCheckoutTest method several_roots.

@TestFor(issues = "TW-49786")
@Test(dataProvider = "severalRootsSetups")
public void several_roots(@NotNull Setup setup) throws Exception {
    myVcsSupport = vcsSupportWithRealGit();
    VcsRoot root1 = vcsRoot().withId(1).withFetchUrl("http://some.org/repo1.git").withAgentGitPath(getGitPath()).build();
    VcsRoot root2 = vcsRoot().withId(2).withFetchUrl("http://some.org/repo2.git").withAgentGitPath(getGitPath()).build();
    AgentRunningBuild build = runningBuild().addRootEntry(root1, setup.getCheckoutRules1()).addRootEntry(root2, setup.getCheckoutRules2()).build();
    AgentCheckoutAbility canCheckout1 = myVcsSupport.canCheckout(root1, new CheckoutRules(setup.getCheckoutRules1()), build);
    AgentCheckoutAbility canCheckout2 = myVcsSupport.canCheckout(root2, new CheckoutRules(setup.getCheckoutRules2()), build);
    if (setup.isShouldFail()) {
        then(canCheckout1.getCanNotCheckoutReason().getDetails()).contains("Cannot checkout VCS root '" + root1.getName() + "' into the same directory as VCS root '" + root2.getName() + "'");
        then(canCheckout2.getCanNotCheckoutReason().getDetails()).contains("Cannot checkout VCS root '" + root2.getName() + "' into the same directory as VCS root '" + root1.getName() + "'");
    } else {
        then(canCheckout1.getCanNotCheckoutReason()).isNull();
        then(canCheckout2.getCanNotCheckoutReason()).isNull();
    }
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) AgentCheckoutAbility(jetbrains.buildServer.agent.vcs.AgentCheckoutAbility) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Aggregations

CheckoutRules (jetbrains.buildServer.vcs.CheckoutRules)71 File (java.io.File)29 GitTestUtil.dataFile (jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile)29 VcsRoot (jetbrains.buildServer.vcs.VcsRoot)25 Test (org.testng.annotations.Test)23 TestFor (jetbrains.buildServer.util.TestFor)21 AgentRunningBuild (jetbrains.buildServer.agent.AgentRunningBuild)13 GitVcsSupport (jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport)10 AgentCheckoutAbility (jetbrains.buildServer.agent.vcs.AgentCheckoutAbility)7 VcsException (jetbrains.buildServer.vcs.VcsException)6 VcsRootImpl (jetbrains.buildServer.vcs.impl.VcsRootImpl)5 FileReader (java.io.FileReader)4 Method (java.lang.reflect.Method)4 FetchCommand (jetbrains.buildServer.buildTriggers.vcs.git.command.FetchCommand)4 SVcsRoot (jetbrains.buildServer.vcs.SVcsRoot)4 BuildTypeOrTemplate (jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate)3 AfterMethod (org.testng.annotations.AfterMethod)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 ArrayList (java.util.ArrayList)2 BuildTriggerDescriptor (jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor)2