Search in sources :

Example 1 with Node

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);
}
Also used : Slave(org.jenkinsci.test.acceptance.po.Slave) OpenstackOneOffSlave(org.jenkinsci.test.acceptance.plugins.openstack.OpenstackOneOffSlave) Node(org.jenkinsci.test.acceptance.po.Node) 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 2 with Node

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'"));
}
Also used : StringParameter(org.jenkinsci.test.acceptance.po.StringParameter) Build(org.jenkinsci.test.acceptance.po.Build) Node(org.jenkinsci.test.acceptance.po.Node) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 3 with Node

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));
}
Also used : Node(org.jenkinsci.test.acceptance.po.Node) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Example 4 with Node

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)));
}
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 5 with Node

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);
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) Node(org.jenkinsci.test.acceptance.po.Node) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

Node (org.jenkinsci.test.acceptance.po.Node)6 Test (org.junit.Test)6 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)4 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)3 Build (org.jenkinsci.test.acceptance.po.Build)3 TestActivation (org.jenkinsci.test.acceptance.junit.TestActivation)2 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)2 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)2 Issue (org.jvnet.hudson.test.Issue)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 CheckStyleAction (org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction)1 DashboardView (org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView)1 MavenModuleSet (org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet)1 OpenstackOneOffSlave (org.jenkinsci.test.acceptance.plugins.openstack.OpenstackOneOffSlave)1 MatrixBuild (org.jenkinsci.test.acceptance.po.MatrixBuild)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 StringParameter (org.jenkinsci.test.acceptance.po.StringParameter)1