Search in sources :

Example 6 with Slave

use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.

the class LocalSlaveController method install.

@Override
public Future<Slave> install(Jenkins jenkins) {
    // Just to make sure the dumb slave is set up properly, we should seed it
    // with a FS root and executors
    final DumbSlave s = jenkins.slaves.create(DumbSlave.class);
    s.asLocal();
    s.save();
    s.waitUntilOnline();
    BasicFuture<Slave> b = new BasicFuture<>(null);
    b.completed(s);
    return b;
}
Also used : DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave) Slave(org.jenkinsci.test.acceptance.po.Slave) BasicFuture(org.apache.http.concurrent.BasicFuture) DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave)

Example 7 with Slave

use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.

the class ScriptTest method execute_system_script.

@Test
public void execute_system_script() throws Exception {
    String output = jenkins.runScript("println Jenkins.instance.displayName;");
    assertThat(output, is("Jenkins"));
    Slave s = slave.install(jenkins).get();
    output = s.runScript("println 6 * 7");
    assertThat(output, is("42"));
}
Also used : Slave(org.jenkinsci.test.acceptance.po.Slave) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) SmokeTest(org.jenkinsci.test.acceptance.junit.SmokeTest) Test(org.junit.Test)

Example 8 with Slave

use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_slave_resourses.

@Test
public void publish_slave_resourses() throws IOException, InterruptedException, ExecutionException {
    DockerContainer dock = container.get();
    Resource cpFile = resource("/ftp_plugin/odes.txt");
    Slave s = slaves.get().install(jenkins).get();
    s.configure();
    s.save();
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyResource(cpFile);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().sourceFile.set("odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/odes.txt", "/tmp"), is(true));
    assertThat(FileUtils.readFileToString(new File("/tmp/odes.txt")), CoreMatchers.is(cpFile.asText()));
}
Also used : DockerContainer(org.jenkinsci.test.acceptance.docker.DockerContainer) Slave(org.jenkinsci.test.acceptance.po.Slave) Resource(org.jenkinsci.test.acceptance.junit.Resource) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) PublishGlobalPublisher(org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher) File(java.io.File) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 9 with Slave

use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.

the class AbstractAnalysisTest method createSlaveForJob.

/**
 * Creates a slave and configures the specified job to run on that slave.
 *
 * @param job job to run on slave
 * @return created slave
 */
public Slave createSlaveForJob(final Job job) {
    try {
        Slave slave = slaveController.install(jenkins).get();
        job.configure();
        job.setLabelExpression(slave.getName());
        job.save();
        return slave;
    } catch (InterruptedException | ExecutionException e) {
        throw new RuntimeException("Can't create Slave", e);
    }
}
Also used : DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave) Slave(org.jenkinsci.test.acceptance.po.Slave) ExecutionException(java.util.concurrent.ExecutionException)

Example 10 with Slave

use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.

the class ExternalWorkspaceManagerPluginTest method setUpNode.

private void setUpNode(String label, String fakeMountingPoint) throws ExecutionException, InterruptedException {
    SlaveController controller = new LocalSlaveController();
    Slave linuxSlave = controller.install(jenkins).get();
    linuxSlave.configure();
    linuxSlave.setLabels(label);
    ExternalNodeConfig nodeConfig = new ExternalNodeConfig(linuxSlave);
    nodeConfig.setConfig(DISK_POOL_ID, DISK_ONE, DISK_TWO, fakeMountingPoint);
    linuxSlave.save();
}
Also used : Slave(org.jenkinsci.test.acceptance.po.Slave) SlaveController(org.jenkinsci.test.acceptance.slave.SlaveController) LocalSlaveController(org.jenkinsci.test.acceptance.slave.LocalSlaveController) LocalSlaveController(org.jenkinsci.test.acceptance.slave.LocalSlaveController) ExternalNodeConfig(org.jenkinsci.test.acceptance.plugins.external_workspace_manager.ExternalNodeConfig)

Aggregations

Slave (org.jenkinsci.test.acceptance.po.Slave)13 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)8 Test (org.junit.Test)8 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)4 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)3 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)3 Script (org.jenkinsci.test.acceptance.plugins.scriptler.Script)2 LocalSlaveController (org.jenkinsci.test.acceptance.slave.LocalSlaveController)2 File (java.io.File)1 IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1 TimeUnit (java.util.concurrent.TimeUnit)1 BasicFuture (org.apache.http.concurrent.BasicFuture)1 DockerContainer (org.jenkinsci.test.acceptance.docker.DockerContainer)1 Resource (org.jenkinsci.test.acceptance.junit.Resource)1 SmokeTest (org.jenkinsci.test.acceptance.junit.SmokeTest)1 TestActivation (org.jenkinsci.test.acceptance.junit.TestActivation)1 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)1 CredentialsPage (org.jenkinsci.test.acceptance.plugins.credentials.CredentialsPage)1