Search in sources :

Example 1 with PluginManager

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

the class JobDslPluginTest method should_fail_on_missing_plugin.

/**
 * Verifies whether the build will be marked as failed or unstable if a plugin must
 * be installed to support all features used in the DSL script.
 */
@Test
public void should_fail_on_missing_plugin() {
    assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
    // check if plugin is installed. if true, disable plugin
    PluginSpec pluginSpec = new PluginSpec("chucknorris");
    PluginManager pm = jenkins.getPluginManager();
    if (pm.isInstalled(pluginSpec)) {
        pm.enablePlugin(pluginSpec.getName(), false);
        jenkins.restart();
    }
    FreeStyleJob seedJob = createSeedJob();
    JobDslBuildStep jobDsl = seedJob.addBuildStep(JobDslBuildStep.class);
    jobDsl.setScript("job('New_Job') {\n" + "   publishers {\n" + "      chucknorris()\n" + "   }\n" + "}");
    seedJob.save();
    Build build = seedJob.scheduleBuild().shouldBeUnstable();
    assertThat(build.getConsole(), containsString("plugin 'chucknorris' needs to be installed"));
    seedJob.configure(() -> jobDsl.setFailOnMissingPlugin(true));
    build = seedJob.scheduleBuild().shouldFail();
    assertThat(build.getConsole(), containsString("plugin 'chucknorris' needs to be installed"));
}
Also used : PluginManager(org.jenkinsci.test.acceptance.po.PluginManager) PluginSpec(org.jenkinsci.test.acceptance.update_center.PluginSpec) JobDslBuildStep(org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep) Build(org.jenkinsci.test.acceptance.po.Build) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 2 with PluginManager

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

the class PluginManagerTest method reproduce.

@Test
@Issue("JENKINS-36239")
public void reproduce() throws Exception {
    PluginManager pm = jenkins.getPluginManager();
    pm.checkForUpdates();
    pm.open();
}
Also used : PluginManager(org.jenkinsci.test.acceptance.po.PluginManager) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)2 PluginManager (org.jenkinsci.test.acceptance.po.PluginManager)2 Test (org.junit.Test)2 JobDslBuildStep (org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep)1 Build (org.jenkinsci.test.acceptance.po.Build)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1 PluginSpec (org.jenkinsci.test.acceptance.update_center.PluginSpec)1 Issue (org.jvnet.hudson.test.Issue)1