use of org.jenkinsci.test.acceptance.po.Node 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.Node in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_resolve_environment_variables.
/**
* Verifies that environment variables are expanded in the file name pattern.
*/
@Test
@Issue("JENKINS-34157")
@WithPlugins("envinject")
public void should_resolve_environment_variables() {
FreeStyleJob job = createFreeStyleJob(RESOURCES + "jenkins-32150", settings -> {
settings.addWorkspaceScanner(CLANG_ID, "${ENV_PREFIX}/${PARAMETER}");
settings.addWorkspaceScanner(JAVA_TITLE, "${BUILD_NUMBER}/nothing");
settings.addWorkspaceScanner(JAVA_DOC_ID, "${BUILD_NUMBER}_${Reference}\\ND4\\ReleaseTools\\Build\\Log\\warning.log");
});
job.configure();
new EnvInjectConfig.Environment(job).properties.sendKeys("ENV_PREFIX=**");
String parameter = "PARAMETER";
job.addParameter(StringParameter.class).setName(parameter);
String reference = "Reference";
job.addParameter(StringParameter.class).setName(reference);
job.save();
Node slave = createSlaveForJob(job);
Map<String, String> parameters = new HashMap<>();
parameters.put("slavename", slave.getName());
parameters.put(parameter, "compile-log.txt");
parameters.put(reference, "master");
Build build = job.startBuild(parameters).shouldSucceed();
assertThatActionExists(job, build, "LLVM/Clang Warnings");
build.open();
int count = 10;
assertThat(driver, hasContent(CLANG_TITLE + ": " + count));
assertThat(build.getConsole(), containsString("[WARNINGS] Parsing warnings in files '**/compile-log.txt' with parser Clang (LLVM based)"));
assertThat(build.getConsole(), containsRegexp("\\[WARNINGS\\] Parsing warnings in files '[\\d]+/nothing'"));
assertThat(build.getConsole(), containsRegexp("\\[WARNINGS\\] Parsing warnings in files '[\\d]+_master\\\\ND4\\\\ReleaseTools\\\\Build\\\\Log\\\\warning.log'"));
}
use of org.jenkinsci.test.acceptance.po.Node in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method configureDashboardFilterBuildExecutors.
@Test
public void configureDashboardFilterBuildExecutors() throws Exception {
final boolean filterBuildExecutors = true;
Node s = slave1.install(jenkins).get();
s.configure();
s.setLabels("test");
s.save();
FreeStyleJob job = jenkins.jobs.create();
DashboardView v = createDashboardView();
v.configure(() -> {
v.mainArea.setFilterBuildExecutors(filterBuildExecutors);
});
v.open();
final List<String> headers = v.buildExecutorStatus.getHeaders();
final List<String> executors = v.buildExecutorStatus.getExecutors();
assertThat(headers.size(), is(2));
assertThat(executors.size(), greaterThan(1));
job.configure(() -> {
job.setLabelExpression("test");
});
v.open();
final List<String> headers2 = v.buildExecutorStatus.getHeaders();
final List<String> executors2 = v.buildExecutorStatus.getExecutors();
// If only one node, the title header is not shown.
assertThat(headers2.size(), is(0));
assertThat(executors2.size(), is(1));
}
use of org.jenkinsci.test.acceptance.po.Node 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)));
}
use of org.jenkinsci.test.acceptance.po.Node in project acceptance-test-harness by jenkinsci.
the class AbstractAnalysisTest method should_retrieve_results_from_slave.
/**
* Builds a job on a slave with checkstyle and verifies that the information checkstyle provides in the tabs about
* the build are the information we expect.
*/
@Test
public void should_retrieve_results_from_slave() throws Exception {
FreeStyleJob job = createFreeStyleJob();
Node slave = createSlaveForJob(job);
Build build = buildSuccessfulJobOnSlave(job, slave);
assertThat(build.getNode(), is(slave));
verifyJobResults(job, build);
}
Aggregations