use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.
the class OpenstackCloudPluginTest method sshSlaveShouldSurviveRestart.
@Test
@WithCredentials(credentialType = WithCredentials.USERNAME_PASSWORD, values = { MACHINE_USERNAME, "ath" })
@TestActivation({ "HARDWARE_ID", "IMAGE_ID", "KEY_PAIR_NAME", "NETWORK_ID" })
public void sshSlaveShouldSurviveRestart() {
assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
configureCloudInit("cloud-init");
configureProvisioning("SSH", "label");
FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.setLabelExpression("label");
job.addShellStep("uname -a");
job.save();
Node created = job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed().getNode();
jenkins.restart();
Node reconnected = job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed().getNode();
assertEquals(created, reconnected);
Slave slave = ((Slave) reconnected);
slave.open();
slave.clickLink("Schedule Termination");
waitFor(slave, pageObjectDoesNotExist(), 1000);
}
use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.
the class SshSlaveController method install.
@Override
public Future<Slave> install(Jenkins j) {
ManagedCredentials credential = new ManagedCredentials(j);
try {
credential.open();
if (credential.checkIfCredentialsExist(fingerprint) == null) {
CredentialsPage cp = new CredentialsPage(j, ManagedCredentials.DEFAULT_DOMAIN);
SshPrivateKeyCredential sc = cp.add(SshPrivateKeyCredential.class);
sc.username.set(machine.getUser());
sc.description.set(fingerprint);
sc.selectEnterDirectly().privateKey.set(keyPair.readPrivateKey());
cp.create();
}
} catch (IOException e) {
throw new AssertionError(e);
}
final Slave s = create(machine.getPublicIpAddress(), j);
// Slave is configured, now wait till its online
return new Future<Slave>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
@Override
public boolean isCancelled() {
return slaveWaitComplete.get();
}
@Override
public boolean isDone() {
return slaveWaitComplete.get() || s.isOnline();
}
@Override
public Slave get() throws InterruptedException, ExecutionException {
waitForOnLineSlave(s, slaveReadyTimeOutInSec);
return s;
}
@Override
public Slave get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
if (unit != TimeUnit.SECONDS) {
timeout = unit.toSeconds(timeout);
}
waitForOnLineSlave(s, (int) timeout);
return s;
}
};
}
use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.
the class MailWatcherPluginTest method notify_slave_on_restart.
@Test
public void notify_slave_on_restart() throws Exception {
assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
Future<Slave> futureSlave = slaveController.install(jenkins);
Slave slave = futureSlave.get();
slave.configure();
{
OnlineStatusNotification notification = new OnlineStatusNotification(slave);
notification.onOnline("on@online.com");
notification.onOffline("on@offline.com");
}
slave.save();
jenkins.restart();
mailhog.assertMail(regex("Computer %s marked offline", slave.getName()), "on@offline.com");
mailhog.assertMail(regex("Computer %s marked online", slave.getName()), "on@online.com");
}
use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.
the class XvncPluginTest method setUp.
@Before
public void setUp() {
Slave slave = containerHolder.get().connect(jenkins);
slave.setLabels("xvnc");
slave.save();
}
use of org.jenkinsci.test.acceptance.po.Slave in project acceptance-test-harness by jenkinsci.
the class DockerBuildStepTest method run_commands_remotelly.
@Test
public void run_commands_remotelly() throws Exception {
Slave slave = slaveController.install(jenkins).get();
FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.setLabelExpression(slave.getName());
job.copyDir(resource("/docker_build_step/context.dir"));
command(job, DockerCommand.CreateImage.class).contextFolder("$WORKSPACE").tag("my_image");
job.save();
Build build = job.startBuild().waitUntilFinished();
assertTrue(build.isSuccess());
}
Aggregations