Search in sources :

Example 6 with SshdContainer

use of org.jenkinsci.test.acceptance.docker.fixtures.SshdContainer in project acceptance-test-harness by jenkinsci.

the class PublishOverSSHPluginTest method ssh_key_text_and_no_password_publishing.

@Test
public void ssh_key_text_and_no_password_publishing() throws IOException {
    SshdContainer sshd = docker.get();
    Resource cp_file = resource(resourceFilePath);
    FreeStyleJob j = jenkins.jobs.create();
    jenkins.configure();
    this.commonConfigPassword("test", false);
    InstanceSite is = this.instanceConfig(sshd);
    this.advancedConfigAllowExec(is, sshd);
    jenkins.save();
    this.configureJobNoExec(j, cp_file);
    j.save();
    j.startBuild().shouldSucceed();
    sshd.cp(tempCopyFile, tempPath);
    assertThat(FileUtils.readFileToString(new File(tempCopyFile)), CoreMatchers.is(cp_file.asText()));
}
Also used : SshdContainer(org.jenkinsci.test.acceptance.docker.fixtures.SshdContainer) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) File(java.io.File) InstanceSite(org.jenkinsci.test.acceptance.plugins.publish_over.PublishOverSSHGlobalConfig.InstanceSite) Test(org.junit.Test)

Example 7 with SshdContainer

use of org.jenkinsci.test.acceptance.docker.fixtures.SshdContainer in project acceptance-test-harness by jenkinsci.

the class ScpPluginTest method configure_job_with_scp_password_publishing.

@Test
public void configure_job_with_scp_password_publishing() throws Exception {
    SshdContainer sshd = docker.get();
    Resource cp_file = resource("/scp_plugin/lorem-ipsum-scp.txt");
    FreeStyleJob j = jenkins.jobs.create();
    jenkins.configure();
    Site s = new ScpGlobalConfig(jenkins).addSite();
    {
        s.hostname.set(sshd.ipBound(22));
        s.port.set(sshd.port(22));
        s.username.set("test");
        s.password.set("test");
        s.rootRepositoryPath.set("/tmp");
    }
    jenkins.save();
    j.configure();
    {
        j.copyResource(cp_file);
        ScpPublisher sp = j.addPublisher(ScpPublisher.class);
        ScpPublisher.Site sps = sp.add();
        sps.sourceFile.set("lorem-ipsum-scp.txt");
        sps.filePath.set("abc");
    }
    j.save();
    j.startBuild().shouldSucceed();
    sshd.cp("/tmp/abc/lorem-ipsum-scp.txt", "/tmp");
    assertThat(FileUtils.readFileToString(new File("/tmp/lorem-ipsum-scp.txt")), CoreMatchers.is(cp_file.asText()));
}
Also used : Site(org.jenkinsci.test.acceptance.plugins.scp.ScpGlobalConfig.Site) SshdContainer(org.jenkinsci.test.acceptance.docker.fixtures.SshdContainer) Resource(org.jenkinsci.test.acceptance.junit.Resource) ScpGlobalConfig(org.jenkinsci.test.acceptance.plugins.scp.ScpGlobalConfig) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) File(java.io.File) ScpPublisher(org.jenkinsci.test.acceptance.plugins.scp.ScpPublisher) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Aggregations

File (java.io.File)7 SshdContainer (org.jenkinsci.test.acceptance.docker.fixtures.SshdContainer)7 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)7 Test (org.junit.Test)7 InstanceSite (org.jenkinsci.test.acceptance.plugins.publish_over.PublishOverSSHGlobalConfig.InstanceSite)5 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)2 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)2 Resource (org.jenkinsci.test.acceptance.junit.Resource)2 ScpGlobalConfig (org.jenkinsci.test.acceptance.plugins.scp.ScpGlobalConfig)2 Site (org.jenkinsci.test.acceptance.plugins.scp.ScpGlobalConfig.Site)2 ScpPublisher (org.jenkinsci.test.acceptance.plugins.scp.ScpPublisher)2