Skip to content

Commit

Permalink
[JENKINS-38794] make @WithPlugins check required version when 'upload…
Browse files Browse the repository at this point in the history
…Plugins=false'
  • Loading branch information
Manuel Franco committed Oct 6, 2016
1 parent 8b79df4 commit 1d64704
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/jenkinsci/test/acceptance/po/PluginManager.java
Expand Up @@ -148,6 +148,12 @@ public boolean isInstalled(String... specs) {
return true;
}

private VersionNumber getAvailableVersionForPlugin(String pluginName) {
// assuming we are on 'available' page
String v = find(by.xpath("//input[starts-with(@name,'plugin.%s.')]/../../td[last()]", pluginName)).getText();
return new VersionNumber(v);
}

/**
* Installs specified plugins.
*
Expand Down Expand Up @@ -224,6 +230,13 @@ public boolean installPlugins(final String... specs) throws UnableToResolveDepen
for (int attempt = 0; attempt < 2; attempt++) {// # of installations attempted, considering retries
visit("available");
check(find(by.xpath("//input[starts-with(@name,'plugin.%s.')]", n)));
VersionNumber availableVersion = getAvailableVersionForPlugin(n);
VersionNumber requiredVersion = new VersionNumber(candidates.get(n));
if (availableVersion.isOlderThan(requiredVersion)) {
throw new AssumptionViolatedException(
String.format("Version '%s' of '%s' is required, but available version is '%s'",
requiredVersion, n, availableVersion));
}

clickButton("Install");

Expand Down

0 comments on commit 1d64704

Please sign in to comment.