提交 4ecd6cc8 编写于 作者: J Jesse Glick

Added testPluginActive to catch problems like in JENKINS-28816.

上级 a7b8ebaa
......@@ -23,9 +23,11 @@
*/
package org.jvnet.hudson.test;
import hudson.PluginWrapper;
import hudson.cli.CLICommand;
import java.io.File;
import java.util.Map;
import jenkins.model.Jenkins;
import junit.framework.TestCase;
import junit.framework.TestSuite;
......@@ -55,7 +57,8 @@ public class PluginAutomaticTestBuilder {
|| notSkipTests("JellyTest")) { // TODO this is probably obsolete given -Dmaven-hpi-plugin.disabledTestInjection
File outputDirectory = new File((String)params.get("outputDirectory"));
TestSuite suite = JellyTestSuiteBuilder.build(outputDirectory,toBoolean(params.get("requirePI")));
suite.addTest(new OtherTests("testCliSanity"));
suite.addTest(new OtherTests("testCliSanity", params));
suite.addTest(new OtherTests("testPluginActive", params));
return suite;
} else {
return new TestSuite();
......@@ -77,13 +80,25 @@ public class PluginAutomaticTestBuilder {
public static class OtherTests extends TestCase {
public OtherTests(String name) {
private final Map<String,?> params;
public OtherTests(String name, Map<String,?> params) {
super(name);
this.params = params;
}
public void testCliSanity() {
CLICommand.clone("help");
}
public void testPluginActive() {
String plugin = (String) params.get("artifactId");
if (plugin != null) {
PluginWrapper pw = Jenkins.getInstance().getPluginManager().getPlugin(plugin);
assertNotNull(pw);
assertTrue(plugin + " was not active", pw.isActive());
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册