Execute restart, when there are only plugins to uninstall

This commit is contained in:
Rene Pfeuffer
2019-09-18 08:35:59 +02:00
parent 780fc2140f
commit f53f6f0a25
2 changed files with 13 additions and 1 deletions

View File

@@ -222,7 +222,7 @@ public class DefaultPluginManager implements PluginManager {
@Override @Override
public void executePendingAndRestart() { public void executePendingAndRestart() {
PluginPermissions.manage().check(); PluginPermissions.manage().check();
if (!pendingQueue.isEmpty()) { if (!pendingQueue.isEmpty() || getInstalled().stream().anyMatch(InstalledPlugin::isMarkedForUninstall)) {
restart("execute pending plugin changes"); restart("execute pending plugin changes");
} }
} }

View File

@@ -415,6 +415,18 @@ class DefaultPluginManagerTest {
verify(mailPlugin).setUninstallable(false); verify(mailPlugin).setUninstallable(false);
} }
@Test
void shouldRestartWithUninstallOnly() {
InstalledPlugin mailPlugin = createInstalled("scm-mail-plugin");
when(mailPlugin.isMarkedForUninstall()).thenReturn(true);
when(loader.getInstalledPlugins()).thenReturn(singletonList(mailPlugin));
manager.executePendingAndRestart();
verify(eventBus).post(any(RestartEvent.class));
}
} }
@Nested @Nested