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"));
}
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();
}
Aggregations