Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not try to create plugin dir when not necessary #295

Merged
merged 2 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ public void start(boolean downloadUc) {
throw new UncheckedIOException("Unable to delete: " + pluginDir.getAbsolutePath(), e);
}
}
createPluginDir(cfg.isCleanPluginDir());
if (cfg.doDownload()) {
createPluginDir(cfg.isCleanPluginDir());
}

if (useLatestSpecified && useLatestAll) {
throw new PluginDependencyStrategyException("Only one plugin dependency version strategy can be selected " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public void startNoDirectoryTest() throws IOException {
.withPluginDir(new File(pluginParentDir, "plugins"))
.withJenkinsWar(Settings.DEFAULT_WAR)
.withJenkinsUc(Settings.DEFAULT_UPDATE_CENTER)
.withDoDownload(true)
.build();

PluginManager pluginManager = new PluginManager(config);
Expand All @@ -117,6 +118,21 @@ public void startNoDirectoryTest() throws IOException {
.isInstanceOf(DirectoryCreationException.class);
}

@Test
public void startNoDirectoryNoPluginDirTest() throws IOException {
File pluginParentDir = folder.newFile();
Config config = Config.builder()
.withPluginDir(new File(pluginParentDir, "plugins"))
.withJenkinsWar(Settings.DEFAULT_WAR)
.withJenkinsUc(Settings.DEFAULT_UPDATE_CENTER)
.withDoDownload(false)
.build();

PluginManager pluginManager = new PluginManager(config);
pluginManager.start();
// everything should be ok.
}

@Test
public void findEffectivePluginsTest() {
Map<String, Plugin> bundledPlugins = new HashMap<>();
Expand Down