Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add failing test that reproduces JENKINS-48604
  • Loading branch information
dwnusbaum committed Dec 18, 2017
1 parent c32b6d8 commit 5098524
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/src/test/java/jenkins/install/LoadDetachedPluginsTest.java
Expand Up @@ -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.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -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;

Expand Down Expand Up @@ -81,6 +84,25 @@ public void upgradeFromJenkins2() {
});
}

@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 -> {
Expand Down
Binary file not shown.

0 comments on commit 5098524

Please sign in to comment.