Skip to content
Browse files

Add failing test that reproduces JENKINS-48604

  • Loading branch information...
dwnusbaum committed Dec 18, 2017
1 parent c32b6d8 commit 5098524513883a48d07fd32d5a6f058d68adb8b8
@@ -26,10 +26,12 @@

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.util.ArrayList;
import java.util.List;
@@ -44,6 +46,7 @@
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 void upgradeFromJenkins2() {

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")));

public void newInstallation() {
rr.then(r -> {
Binary file not shown.

0 comments on commit 5098524

Please sign in to comment.
You can’t perform that action at this time.