Search in sources :

Example 16 with WithCredentials

use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.

the class OpenstackCloudPluginTest method scheduleMatrixWithoutLabel.

@Test
@Issue("JENKINS-29998")
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { MACHINE_USERNAME, "/openstack_plugin/unsafe" })
@TestActivation({ "HARDWARE_ID", "IMAGE_ID", "KEY_PAIR_NAME", "NETWORK_ID" })
@WithPlugins("matrix-project")
public void scheduleMatrixWithoutLabel() {
    configureCloudInit("cloud-init");
    configureProvisioning("SSH", "label");
    jenkins.configure();
    jenkins.getConfigPage().numExecutors.set(0);
    jenkins.save();
    MatrixProject job = jenkins.jobs.create(MatrixProject.class);
    job.configure();
    job.save();
    MatrixBuild pb = job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed().as(MatrixBuild.class);
    assertThat(pb.getNode(), equalTo((Node) jenkins));
    MatrixRun cb = pb.getConfiguration("default");
    assertThat(cb.getNode(), not(equalTo((Node) jenkins)));
}
Also used : Node(org.jenkinsci.test.acceptance.po.Node) MatrixRun(org.jenkinsci.test.acceptance.po.MatrixRun) MatrixProject(org.jenkinsci.test.acceptance.po.MatrixProject) MatrixBuild(org.jenkinsci.test.acceptance.po.MatrixBuild) Issue(org.jvnet.hudson.test.Issue) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) TestActivation(org.jenkinsci.test.acceptance.junit.TestActivation)

Example 17 with WithCredentials

use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.

the class OpenstackCloudPluginTest method provisionSshSlaveWithPasswdAuthRetryOnFailedAuth.

@Test
@WithCredentials(credentialType = WithCredentials.USERNAME_PASSWORD, values = { MACHINE_USERNAME, "ath" })
@TestActivation({ "HARDWARE_ID", "IMAGE_ID", "KEY_PAIR_NAME", "NETWORK_ID" })
public void provisionSshSlaveWithPasswdAuthRetryOnFailedAuth() {
    configureCloudInit("cloud-init-authfix");
    configureProvisioning("SSH", "label");
    FreeStyleJob job = jenkins.jobs.create();
    job.configure();
    job.setLabelExpression("label");
    job.save();
    job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed();
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) TestActivation(org.jenkinsci.test.acceptance.junit.TestActivation)

Example 18 with WithCredentials

use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.

the class WarningsPluginTest method detailsTabContentWithOneWarningTest.

@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void detailsTabContentWithOneWarningTest() throws ExecutionException, InterruptedException {
    WarningsAction action = createAndBuildCompileJobOnAgent(resource("/warnings_plugin/WarningMain2.java"), "javac -Xlint:all WarningMain2.java");
    SortedMap<String, String> details = action.getDetailsTabContents();
    assertThat("Assert the proper detail count.", details.entrySet(), hasSize(1));
    assertThatDetailsAre(details, "redundant cast to TextClass", "WarningMain2.java:9");
}
Also used : WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

Example 19 with WithCredentials

use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.

the class WarningsPluginTest method should_scan_files_on_slave.

@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void should_scan_files_on_slave() {
    DumbSlave dockerSlave = createDockerAgent();
    FreeStyleJob job = prepareDockerSlave(dockerSlave);
    job.configure();
    job.copyResource(resource("/warnings_plugin/out.txt"));
    job.addPublisher(WarningsPublisher.class).addWorkspaceFileScanner(JAVA_ID, "out.txt");
    job.save();
    Build build = job.startBuild().shouldSucceed();
    assertThatActionExists(job, build, "Java Warnings");
    build.open();
    assertThat(driver, hasContent("Java Warnings: " + 2));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) WarningsPublisher(org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

Example 20 with WithCredentials

use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.

the class WarningsPluginTest method should_have_correct_details.

@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void should_have_correct_details() throws ExecutionException, InterruptedException {
    WarningsAction action = createAndBuildCompileJobOnAgent(resource("/warnings_plugin/WarningMain.java"), "javac -Xlint:all WarningMain.java");
    SortedMap<String, String> details = action.getDetailsTabContents();
    assertThat("Assert the proper detail count.", details.entrySet(), hasSize(3));
    assertThatDetailsAre(details, "redundant cast to TextClass", "WarningMain.java:10");
    // removing tested entry from details.
    details.remove(details.firstKey());
    assertThatDetailsAre(details, "redundant cast to TextClass", "WarningMain.java:11");
    // removing tested entry from details.
    details.remove(details.firstKey());
    assertThatDetailsAre(details, "division by zero", "WarningMain.java:14");
}
Also used : WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

Aggregations

WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)21 Test (org.junit.Test)21 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)14 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)13 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)11 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)10 TestActivation (org.jenkinsci.test.acceptance.junit.TestActivation)8 Build (org.jenkinsci.test.acceptance.po.Build)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)5 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)5 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)5 Issue (org.jvnet.hudson.test.Issue)5 WarningsAction (org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction)3 WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)3 Matchers.containsString (org.hamcrest.Matchers.containsString)2 SvnContainer (org.jenkinsci.test.acceptance.docker.fixtures.SvnContainer)2 SubversionScm (org.jenkinsci.test.acceptance.plugins.subversion.SubversionScm)2 WarningsPublisher (org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher)2 MatrixBuild (org.jenkinsci.test.acceptance.po.MatrixBuild)2 Node (org.jenkinsci.test.acceptance.po.Node)2