Search in sources :

Example 81 with WithPlugins

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

the class MavenPluginTest method useWithTasks.

@Issue("JENKINS-22252")
@WithPlugins({ "maven-plugin@2.12", "tasks" })
@Test
public void useWithTasks() throws InterruptedException {
    MavenInstallation.installMaven(jenkins, "Maven 3.2.x", "3.2.1");
    MavenModuleSet job = jenkins.jobs.create(MavenModuleSet.class);
    job.configure();
    job.copyDir(resource("/maven_plugin/multimodule/"));
    job.goals.set("package");
    job.addBuildSettings(TasksMavenSettings.class);
    job.save();
    Build build = job.startBuild().shouldSucceed();
    assertThat(build.getConsole(), not(containsString("IllegalAccessError")));
}
Also used : MavenBuild(org.jenkinsci.test.acceptance.plugins.maven.MavenBuild) Build(org.jenkinsci.test.acceptance.po.Build) MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 82 with WithPlugins

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

the class WarningsPluginTest method should_find_warnings_without_sleep.

/**
 * Runs a pipeline script that compiles a file with some warnings. The warnings plug-in should find all
 * 6 warnings.
 */
@Test
@WithPlugins("workflow-aggregator")
@Issue("32191")
@Ignore("Exposes bug JENKINS-32191")
public void should_find_warnings_without_sleep() {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    job.script.set("node {\n" + "    writeFile(file: \"a.c\", text: '''\n" + "#include <sys/types.h>\n" + "#include <stdlib.h>\n" + "\n" + "void\n" + "func1(void)\n" + "{\n" + "}\n" + "\n" + "int\n" + "main(int argc, char *argv[])\n" + "{\n" + "    char *a;\n" + "    int64_t *b;\n" + "    b = (int64_t *)a;\n" + "    printf(\"Hi\");\n" + "    printf(NULL);\n" + "    printf(\"%s %d\\\\n\", \"35\");\n" + "    func1();\n" + "}\n" + "'''\n" + "    )\n" + "    sh \"cc -Wall -W -Wcast-align -o output a.c\"\n" + "    step([$class: 'WarningsPublisher',\n" + "         canComputeNew: false,\n" + "         canResolveRelativePaths: false,\n" + "         consoleParsers: [[parserName: 'Clang (LLVM based)']],\n" + "         defaultEncoding: '',\n" + "         excludePattern: '',\n" + "         healthy: '',\n" + "         includePattern: '',\n" + "         messagesPattern: '',\n" + "         unHealthy: ''])\n" + "}\n");
    job.sandbox.check();
    job.save();
    Build build = buildSuccessfulJob(job);
    assertThatActionExists(job, build, "LLVM/Clang Warnings");
    build.open();
    Pattern warnings = Pattern.compile("LLVM/Clang Warnings: ([1-9][0-9]*)");
    // some warnings, number depends on actual compiler version
    assertThat(driver, hasContent(warnings));
    int actualWarnings = extractWarningsCountFromPage(warnings);
    buildSuccessfulJob(job);
    // FIXME: move to verify trend graph
    job.open();
    verifyTrendGraph(job, actualWarnings);
}
Also used : Pattern(java.util.regex.Pattern) Build(org.jenkinsci.test.acceptance.po.Build) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) Ignore(org.junit.Ignore) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 83 with WithPlugins

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

the class TSRCreateSlaveTest method newSlaveWithExistingCredential.

@Test
@WithPlugins("credentials@2.0.7")
public void newSlaveWithExistingCredential() throws Exception {
    String username = "xyz";
    String description = "SSH Key setup";
    String privateKey = "1212121122121212";
    CredentialsPage c = new CredentialsPage(jenkins, "_");
    c.open();
    SshPrivateKeyCredential sc = c.add(SshPrivateKeyCredential.class);
    sc.username.set(username);
    sc.description.set(description);
    sc.selectEnterDirectly().privateKey.set(privateKey);
    c.create();
    // now verify
    c.open();
    ManagedCredentials mc = new ManagedCredentials(jenkins);
    String href = mc.credentialById("ssh_creds");
    c.setConfigUrl(href);
    verifyValueForCredential(c, sc.username, username);
    verifyValueForCredential(c, sc.selectEnterDirectly().privateKey, privateKey);
    // 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);
    SshSlaveLauncher l = s.setLauncher(SshSlaveLauncher.class);
    l.host.set("127.0.0.1");
    l.credentialsId.select(String.format("%s (%s)", username, description));
}
Also used : SshPrivateKeyCredential(org.jenkinsci.test.acceptance.plugins.ssh_credentials.SshPrivateKeyCredential) SshSlaveLauncher(org.jenkinsci.test.acceptance.plugins.ssh_slaves.SshSlaveLauncher) CredentialsPage(org.jenkinsci.test.acceptance.plugins.credentials.CredentialsPage) Matchers.containsString(org.hamcrest.Matchers.containsString) DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave) ManagedCredentials(org.jenkinsci.test.acceptance.plugins.credentials.ManagedCredentials) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 84 with WithPlugins

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

the class AbstractAnalysisTest method should_show_warnings_in_folder.

/**
 * Sets up a nested view that contains a dashboard view with a warnings-per-project portlet.
 * Creates a folder in this view and a freestyle job in this folder.
 * Finally checks if the warnings-per-project portlet and warnings column show the
 * correct number of warnings and provide a direct link to the actual warning results.
 */
@Test
@Issue("JENKINS-39947")
@WithPlugins({ "dashboard-view", "nested-view", "cloudbees-folder", "analysis-core@1.87" })
public void should_show_warnings_in_folder() {
    // avoid JENKINS-49026
    checkExtensionAreDeployed("hudson.plugins.analysis.dashboard.AbstractPortlet", Collections.EMPTY_SET);
    NestedView nested = jenkins.getViews().create(NestedView.class);
    DashboardView dashboard = nested.getViews().create(DashboardView.class);
    dashboard.configure(() -> {
        dashboard.matchAllJobs();
        dashboard.checkRecurseIntoFolders();
    });
    Folder folder = dashboard.jobs.create(Folder.class);
    folder.save();
    folder.open();
    FreeStyleJob job = createFreeStyleJob(folder);
    runAndVerifyJobResults(job);
    P projectAction = createProjectAction(job);
    dashboard.configure(() -> {
        dashboard.addBottomPortlet(projectAction.getTablePortlet());
    });
    verifyPortlet(projectAction);
    addListViewColumn(projectAction.getViewColumn(), folder);
    verifyColumn(projectAction);
}
Also used : NestedView(org.jenkinsci.test.acceptance.plugins.nested_view.NestedView) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Folder(org.jenkinsci.test.acceptance.po.Folder) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 85 with WithPlugins

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

the class AbstractAnalysisTest method should_show_warning_totals_in_dashboard_portlet_with_link_to_results.

/**
 * Sets up a dashboard view with a warnings-per-project portlet. Builds a job and checks if the portlet shows the
 * correct number of warnings and provides a direct link to the actual warning results.
 */
@Test
@WithPlugins("dashboard-view")
public void should_show_warning_totals_in_dashboard_portlet_with_link_to_results() {
    // avoid JENKINS-49026
    checkExtensionAreDeployed("hudson.plugins.analysis.dashboard.AbstractPortlet", Collections.EMPTY_SET);
    FreeStyleJob job = createFreeStyleJob();
    buildJobAndWait(job).shouldSucceed();
    P projectAction = createProjectAction(job);
    addDashboardViewAndBottomPortlet(projectAction.getTablePortlet(), jenkins);
    verifyPortlet(projectAction);
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Aggregations

WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)89 Test (org.junit.Test)89 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)71 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)53 Build (org.jenkinsci.test.acceptance.po.Build)39 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)31 Issue (org.jvnet.hudson.test.Issue)25 Job (org.jenkinsci.test.acceptance.po.Job)19 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)15 WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)15 ListView (org.jenkinsci.test.acceptance.po.ListView)13 View (org.jenkinsci.test.acceptance.po.View)13 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)12 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)11 JobDslBuildStep (org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep)10 Matchers.containsString (org.hamcrest.Matchers.containsString)9 GlobalSecurityConfig (org.jenkinsci.test.acceptance.po.GlobalSecurityConfig)9 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)8 Ignore (org.junit.Ignore)8 WarningsAction (org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction)5