use of org.jenkinsci.test.acceptance.plugins.git.GitRepo in project acceptance-test-harness by jenkinsci.
the class GitPluginTest method sparse_checkout.
@Test
public void sparse_checkout() {
final String SUB_DIR = "testDir";
final String TEST_FILE = "testFile.txt";
GitRepo repo = buildGitRepo();
repo.touch(SUB_DIR + "/" + TEST_FILE);
repo.touch(TEST_FILE);
repo.addFilesIn(getClass().getResource("."));
repo.commit("Added two test files.");
repo.transferToDockerContainer(host, port);
job.useScm(GitScm.class).url(repoUrl).credentials(USERNAME).sparseCheckout().addPath(SUB_DIR);
job.addShellStep("test ! -f " + TEST_FILE + " && test -f " + SUB_DIR + "/" + TEST_FILE);
job.save();
Build b = job.startBuild();
b.shouldSucceed();
}
use of org.jenkinsci.test.acceptance.plugins.git.GitRepo in project acceptance-test-harness by jenkinsci.
the class WorkflowPluginTest method createGitRepositoryInDockerContainer.
private String createGitRepositoryInDockerContainer() throws IOException {
try (GitRepo repo = new GitRepo()) {
repo.addFilesIn(getClass().getResource("/pipelines/hello-world"));
repo.commit("Initial commit.");
GitContainer container = gitServer.get();
repo.transferToDockerContainer(container.host(), container.port());
return container.getRepoUrl();
}
}
use of org.jenkinsci.test.acceptance.plugins.git.GitRepo in project acceptance-test-harness by jenkinsci.
the class GitPluginTest method ancestry_strategy_to_choose_build.
@Test
public void ancestry_strategy_to_choose_build() {
final String TEST_BRANCH = "testBranch";
GitRepo repo = buildGitRepo();
repo.createBranch(TEST_BRANCH);
repo.changeAndCommitFoo("Commit1 on master");
repo.checkout(TEST_BRANCH);
repo.changeAndCommitFoo("commit1 on " + TEST_BRANCH);
String sha1 = repo.getLastSha1();
repo.changeAndCommitFoo("commit2 on " + TEST_BRANCH);
repo.transferToDockerContainer(host, port);
job.useScm(GitScm.class).url(repoUrl).branch("").credentials(USERNAME).chooseBuildStrategy("Ancestry", 1, sha1);
job.save();
Build b = job.startBuild();
b.shouldSucceed();
// TODO Multiple selected branches create multiple builds, these should also be verified
assertThat(b.getConsole(), Matchers.containsRegexp("Checking out Revision .* \\(origin/" + TEST_BRANCH + "\\)", Pattern.MULTILINE));
}
use of org.jenkinsci.test.acceptance.plugins.git.GitRepo in project acceptance-test-harness by jenkinsci.
the class AnalysisCollectorPluginTest method createGitRepositoryInDockerContainer.
private String createGitRepositoryInDockerContainer() {
GitRepo repo = new GitRepo();
repo.addFilesIn(ANALYSIS_COLLECTOR_PLUGIN_RESOURCES);
repo.commit("Initial commit in master");
repo.createBranch("branch");
GitContainer container = gitServer.get();
repo.transferToDockerContainer(container.host(), container.port());
return container.getRepoUrl();
}
Aggregations