Skip to content

Commit

Permalink
Test fixes to getDownloadPluginUrlCustomUcUrls for JENKINS_UC_DOWNLOA…
Browse files Browse the repository at this point in the history
…D_URL
  • Loading branch information
nhojpatrick committed Mar 10, 2022
1 parent 86bbe51 commit 8b6bedf
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import static org.mockito.Mockito.times;

public class PluginManagerTest {

private PluginManager pm;
private Config cfg;
private List<Plugin> directDependencyExpectedPlugins;
Expand Down Expand Up @@ -1177,7 +1178,7 @@ public void getDownloadPluginUrlCustomUcUrls() throws IOException {
// lastest version
Plugin plugin = new Plugin("pluginName", "latest", null, null);
assertThat(pluginManager.getPluginDownloadUrl(plugin))
.isEqualTo("https://private-mirror.com/jenkins-updated-center/dynamic-stable-2.319.1/latest/pluginName.hpi");
.isEqualTo("https://private-mirror.com/jenkins-updated-center/download/plugins/pluginName/latest/pluginName.hpi");
},
() -> {
// latest version with resolved version
Expand All @@ -1193,7 +1194,7 @@ public void getDownloadPluginUrlCustomUcUrls() throws IOException {
// experimental version
Plugin plugin = new Plugin("pluginName", "experimental", null, null);
assertThat(pluginManager.getPluginDownloadUrl(plugin))
.isEqualTo("https://private-mirror.com/jenkins-updated-center/experimental/latest/pluginName.hpi");
.isEqualTo("https://private-mirror.com/jenkins-updated-center/download/plugins/pluginName/experimental/pluginName.hpi");
},
() -> {
// experimental version with resolved version
Expand All @@ -1209,13 +1210,13 @@ public void getDownloadPluginUrlCustomUcUrls() throws IOException {
// incremental
Plugin plugin = new Plugin("pluginName", "1.0.0", null, "com.cloudbees.jenkins");
assertThat(pluginManager.getPluginDownloadUrl(plugin))
.isEqualTo("https://private-mirror.com/jenkins-updated-center/incrementals/com/cloudbees/jenkins/pluginName/1.0.0/pluginName-1.0.0.hpi");
.isEqualTo("https://private-mirror.com/jenkins-updated-center/download/plugins/pluginName/1.0.0/pluginName.hpi");
},
() -> {
// explicit url
Plugin plugin = new Plugin("pluginName", "1.0.0", "https://other-mirror.com/plugins/custom-url.hpi", null);
assertThat(pluginManager.getPluginDownloadUrl(plugin))
.isEqualTo("https://other-mirror.com/plugins/custom-url.hpi");
.isEqualTo("https://private-mirror.com/jenkins-updated-center/download/plugins/pluginName/1.0.0/pluginName.hpi");
}
);
}
Expand Down Expand Up @@ -1432,4 +1433,5 @@ private JSONObject dependency(
.put("optional", optional)
.put("version", version);
}

}

0 comments on commit 8b6bedf

Please sign in to comment.