Search in sources :

Example 6 with TestActivation

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

the class OpenstackCloudPluginTest method provisionSshSlave.

@Test
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { MACHINE_USERNAME, "/openstack_plugin/unsafe" })
@TestActivation({ "HARDWARE_ID", "IMAGE_ID", "KEY_PAIR_NAME", "NETWORK_ID" })
public void provisionSshSlave() {
    configureCloudInit("cloud-init");
    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 7 with TestActivation

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

the class OpenstackCloudPluginTest method usePerBuildInstance.

@Test
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { MACHINE_USERNAME, "/openstack_plugin/unsafe" })
@TestActivation({ "HARDWARE_ID", "IMAGE_ID", "KEY_PAIR_NAME", "NETWORK_ID" })
public void usePerBuildInstance() {
    configureCloudInit("cloud-init");
    configureProvisioning("SSH", "unused");
    FreeStyleJob job = jenkins.jobs.create();
    job.configure();
    OpenstackBuildWrapper bw = job.addBuildWrapper(OpenstackBuildWrapper.class);
    bw.cloud(CLOUD_NAME);
    bw.template(CLOUD_DEFAULT_TEMPLATE);
    bw.count(1);
    // Wait a little for the other machine to start responding
    job.addShellStep("while ! ping -c 1 \"$JCLOUDS_IPS\"; do :; done");
    job.save();
    job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed();
}
Also used : OpenstackBuildWrapper(org.jenkinsci.test.acceptance.plugins.openstack.OpenstackBuildWrapper) 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 8 with TestActivation

use of org.jenkinsci.test.acceptance.junit.TestActivation 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 9 with TestActivation

use of org.jenkinsci.test.acceptance.junit.TestActivation 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)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)9 TestActivation (org.jenkinsci.test.acceptance.junit.TestActivation)9 Test (org.junit.Test)9 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)8 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)8 MatrixBuild (org.jenkinsci.test.acceptance.po.MatrixBuild)2 Node (org.jenkinsci.test.acceptance.po.Node)2 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 OpenstackBuildWrapper (org.jenkinsci.test.acceptance.plugins.openstack.OpenstackBuildWrapper)1 OpenstackOneOffSlave (org.jenkinsci.test.acceptance.plugins.openstack.OpenstackOneOffSlave)1 Build (org.jenkinsci.test.acceptance.po.Build)1 JdkInstallation (org.jenkinsci.test.acceptance.po.JdkInstallation)1 MatrixProject (org.jenkinsci.test.acceptance.po.MatrixProject)1 MatrixRun (org.jenkinsci.test.acceptance.po.MatrixRun)1 Slave (org.jenkinsci.test.acceptance.po.Slave)1 Issue (org.jvnet.hudson.test.Issue)1