提交 50985245 编写于 作者: D Devin Nusbaum

Add failing test that reproduces JENKINS-48604

上级 c32b6d80
......@@ -26,10 +26,12 @@ package jenkins.install;
import hudson.ClassicPluginStrategy;
import hudson.ClassicPluginStrategy.DetachedPlugin;
import hudson.Plugin;
import hudson.PluginManager;
import hudson.PluginManagerUtil;
import hudson.PluginWrapper;
import hudson.util.VersionNumber;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
......@@ -44,6 +46,7 @@ import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
......@@ -81,6 +84,25 @@ public class LoadDetachedPluginsTest {
});
}
@Issue("JENKINS-48604")
@Test
@LocalData
public void upgradeFromJenkins2WithDependency() {
VersionNumber since = new VersionNumber("2.0");
rr.then((JenkinsRule r) -> {
List<DetachedPlugin> detachedPlugins = ClassicPluginStrategy.getDetachedPlugins(since);
assertThat("Plugins have been detached since the pre-upgrade version",
detachedPlugins.size(), greaterThan(1));
assertThat("Plugins detached between the pre-upgrade version and the current version should be installed",
getInstalledDetachedPlugins(r, detachedPlugins).size(), equalTo(detachedPlugins.size()));
Plugin scriptSecurity = r.jenkins.getPlugin("script-security");
assertThat("Script-security should be installed", scriptSecurity, notNullValue());
assertThat("Dependencies of detached plugins should not be downgraded",
scriptSecurity.getWrapper().getVersionNumber(), greaterThan(new VersionNumber("1.18.1")));
assertNoFailedPlugins(r);
});
}
@Test
public void newInstallation() {
rr.then(r -> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册