mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-17 01:30:27 +01:00
Resolve plugin installation conflict were the same plugin was tried to be installed multiple times for one single action. (#2138)
The pending queue is updated after all the plugins to be installed are collected, and then we already may have duplicate entries. Because of this we check right on the collecting step if the plugin was already added during this single action.
This commit is contained in:
@@ -242,6 +242,24 @@ class DefaultPluginManagerTest {
|
||||
verify(installer).install(context, review);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldInstallMultipleSameDependingPluginsOnlyOnce() {
|
||||
AvailablePlugin review = createAvailable("scm-review-plugin");
|
||||
AvailablePlugin ci = createAvailable("scm-ci-plugin", "1.1.0");
|
||||
InstalledPlugin oldCi = createInstalled("scm-ci-plugin", "1.0.0");
|
||||
when(review.getDescriptor().getDependencies()).thenReturn(ImmutableSet.of("scm-mail-plugin", "scm-ci-plugin"));
|
||||
AvailablePlugin mail = createAvailable("scm-mail-plugin");
|
||||
when(mail.getDescriptor().getOptionalDependencies()).thenReturn(ImmutableSet.of("scm-ci-plugin"));
|
||||
when(center.getAvailablePlugins()).thenReturn(ImmutableSet.of(review, mail, ci));
|
||||
when(loader.getInstalledPlugins()).thenReturn(ImmutableSet.of(oldCi));
|
||||
|
||||
manager.install("scm-review-plugin", false);
|
||||
|
||||
verify(installer).install(context, mail);
|
||||
verify(installer).install(context, review);
|
||||
verify(installer, times(1)).install(context, ci);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotInstallAlreadyInstalledDependenciesWhenUpToDate() {
|
||||
AvailablePlugin review = createAvailable("scm-review-plugin");
|
||||
|
||||
Reference in New Issue
Block a user