use of org.jenkinsci.test.acceptance.plugins.git.GitScm in project acceptance-test-harness by jenkinsci.
the class GitPluginTest method advanced_clone_test.
@Test
public void advanced_clone_test() {
final String TEST_INITIAL_COMMIT = "Initial commit";
final String TEST_COMMIT1_MESSAGE = "First commit";
final String TEST_COMMIT2_MESSAGE = "Second commit";
Build b;
GitRepo repo = buildGitRepo();
repo.changeAndCommitFoo(TEST_COMMIT1_MESSAGE);
repo.changeAndCommitFoo(TEST_COMMIT2_MESSAGE);
repo.transferToDockerContainer(host, port);
GitScm gitScm = job.useScm(GitScm.class).url(repoUrl).credentials(USERNAME);
job.addShellStep("git log");
job.save();
b = job.startBuild();
b.shouldSucceed();
String console = b.getConsole();
assertThat(console, Matchers.containsRegexp(TEST_INITIAL_COMMIT, Pattern.MULTILINE));
assertThat(console, Matchers.containsRegexp(TEST_COMMIT1_MESSAGE, Pattern.MULTILINE));
assertThat(console, Matchers.containsRegexp(TEST_COMMIT2_MESSAGE, Pattern.MULTILINE));
job.configure();
GitScm.AdvancedClone behaviour = gitScm.advancedClone().checkShallowClone(true).setNumDepth("2");
job.save();
b = job.startBuild();
b.shouldSucceed();
console = b.getConsole();
assertThat(console, not(Matchers.containsRegexp(TEST_INITIAL_COMMIT, Pattern.MULTILINE)));
assertThat(console, Matchers.containsRegexp(TEST_COMMIT1_MESSAGE, Pattern.MULTILINE));
assertThat(console, Matchers.containsRegexp(TEST_COMMIT2_MESSAGE, Pattern.MULTILINE));
job.configure();
behaviour.setNumDepth("1");
job.save();
b = job.startBuild();
b.shouldSucceed();
console = b.getConsole();
assertThat(console, not(Matchers.containsRegexp(TEST_INITIAL_COMMIT, Pattern.MULTILINE)));
assertThat(console, not(Matchers.containsRegexp(TEST_COMMIT1_MESSAGE, Pattern.MULTILINE)));
assertThat(console, Matchers.containsRegexp(TEST_COMMIT2_MESSAGE, Pattern.MULTILINE));
}
use of org.jenkinsci.test.acceptance.plugins.git.GitScm in project acceptance-test-harness by jenkinsci.
the class GitPluginTest method advanced_checkout_test.
@Test
public void advanced_checkout_test() {
final String TEST_COMMIT_MESSAGE = "First commit";
final String TEST_TIME_OUT = "2";
Build b;
GitRepo repo = buildGitRepo();
repo.changeAndCommitFoo(TEST_COMMIT_MESSAGE);
repo.transferToDockerContainer(host, port);
GitScm gitScm = job.useScm(GitScm.class).url(repoUrl).credentials(USERNAME);
job.save();
b = job.startBuild();
b.shouldSucceed();
String console = b.getConsole();
String revision = getRevisionFromConsole(console);
assertThat(console, not(Matchers.containsRegexp("git checkout -f " + revision + " # timeout=" + TEST_TIME_OUT, Pattern.MULTILINE)));
job.configure();
gitScm.advancedCheckout().setTimeOut(TEST_TIME_OUT);
job.save();
b = job.startBuild();
b.shouldSucceed();
console = b.getConsole();
assertThat(console, Matchers.containsRegexp("git checkout -f " + revision + " # timeout=" + TEST_TIME_OUT, Pattern.MULTILINE));
}
use of org.jenkinsci.test.acceptance.plugins.git.GitScm in project acceptance-test-harness by jenkinsci.
the class MultipleScmsPluginTest method poll_for_changes.
@Test
public void poll_for_changes() {
FreeStyleJob job = jenkins.jobs.create();
job.configure();
MultipleScms scms = job.useScm(MultipleScms.class);
GitScm git = scms.addScm(GitScm.class);
git.url("git://github.com/jenkinsci/acceptance-test-harness.git");
git.localDir("git-project");
job.pollScm().schedule("* * * * *");
job.addShellStep("test -f git-project/pom.xml");
job.save();
elasticSleep(70000);
// We should have some build after 70 seconds
job.getLastBuild().shouldSucceed().shouldExist();
}
use of org.jenkinsci.test.acceptance.plugins.git.GitScm in project acceptance-test-harness by jenkinsci.
the class GitPluginNoDockerTest method generateJobWithLocalBranch.
private Job generateJobWithLocalBranch(GIT_IMPL type) {
Job job = generateJob(type);
GitScm scm = generateSCM(job).localBranch("selenium_test_branch");
useJGitIfNeccesary(type, scm);
return job;
}
use of org.jenkinsci.test.acceptance.plugins.git.GitScm in project acceptance-test-harness by jenkinsci.
the class GitPluginNoDockerTest method generateJobWithRemoteName.
private Job generateJobWithRemoteName(GIT_IMPL type) {
Job job = generateJob(type);
GitScm scm = generateSCM(job).remoteName("custom_origin");
useJGitIfNeccesary(type, scm);
return job;
}
Aggregations