Search in sources :

Example 31 with WorkflowJob

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

the class TaskScannerPluginTest method createPipeline.

@Override
protected WorkflowJob createPipeline() {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    String[] files = { "TSRBuildTimeoutPluginTest.java", "TSRCleaner.java", "TSRCreateSlaveTest.java", "TSRDockerImage.java", "TSREc2Provider.java", "TSRGitRepo.java", "TSRJenkinsAcceptanceTestRule.java", "TSRTestCleaner.java", "TSRWinstoneDockerController.java" };
    StringBuilder copyFilesWithTasks = new StringBuilder();
    for (String file : files) {
        copyFilesWithTasks.append(job.copyResourceStep(TASKS_FILES + "/" + file));
    }
    job.script.set("node {\n" + copyFilesWithTasks.toString() + "  step([$class: 'TasksPublisher', high: 'FIXME', normal: 'TODO', low: '@Deprecated'," + "excludePattern: '**/*Test.java'])\n}");
    job.sandbox.check();
    job.save();
    return job;
}
Also used : WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob)

Example 32 with WorkflowJob

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

the class WarningsPluginTest method createPipeline.

@Override
protected WorkflowJob createPipeline() {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    job.script.set("node {\n" + job.copyResourceStep(SEVERAL_PARSERS_FILE_FULL_PATH) + "  step([$class: 'WarningsPublisher', " + "     parserConfigurations: [" + "             [parserName: 'Java Compiler (javac)', pattern: '**/warningsAll.txt']," + "     ]])\n}");
    job.sandbox.check();
    job.save();
    return job;
}
Also used : WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob)

Example 33 with WorkflowJob

use of org.jenkinsci.test.acceptance.po.WorkflowJob 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 34 with WorkflowJob

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

the class AnalysisCollectorPluginTest method should_compute_annotations_on_workflow.

@Test
@WithPlugins("workflow-aggregator")
public void should_compute_annotations_on_workflow() {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    job.script.set("node {\n" + copyFileToWorkspace(job, "checkstyle-result.xml") + copyFileToWorkspace(job, "findbugs.xml") + "  step([$class: 'FindBugsPublisher', pattern: '**/findbugs.xml'])\n" + "  step([$class: 'CheckStylePublisher'])\n" + "  step([$class: 'AnalysisPublisher'])\n" + "}");
    job.sandbox.check();
    job.save();
    final Build build = job.startBuild();
    build.shouldSucceed();
    assertThat(build, hasAction("Static Analysis Warnings"));
    AnalysisCollectorAction action = new AnalysisCollectorAction(build);
    action.open();
    assertThat(action.getNumberOfWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL));
    assertThat(action.getNumberOfNewWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) AnalysisCollectorAction(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 35 with WorkflowJob

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

the class AnalysisCollectorPluginTest method buildBranch.

private WorkflowJob buildBranch(WorkflowMultiBranchJob job, String branchName) {
    WorkflowJob master = job.getJob(branchName);
    master.build(1).waitUntilFinished().shouldSucceed();
    return master;
}
Also used : WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob)

Aggregations

WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)36 Test (org.junit.Test)24 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)21 Build (org.jenkinsci.test.acceptance.po.Build)19 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)14 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)8 StageView (org.jenkinsci.test.acceptance.plugins.stageview.StageView)8 Matchers.containsString (org.hamcrest.Matchers.containsString)4 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)4 Issue (org.jvnet.hudson.test.Issue)4 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)3 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)3 Category (org.junit.experimental.categories.Category)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Ignore (org.junit.Ignore)2 File (java.io.File)1 IOException (java.io.IOException)1 Pattern (java.util.regex.Pattern)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1 LocalController (org.jenkinsci.test.acceptance.controller.LocalController)1