test(plugins): wait for global recovery without an extra restart (#8250)

* test(plugins): observe global recovery without reloading again

* test(plugins): leave time for recovery failure cleanup

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
This commit is contained in:
paseo-bot[bot]
2026-10-30 03:38:37 +00:00
committed by GitHub
parent 9c7925de58
commit deb1bdc266
@@ -1075,23 +1075,29 @@ export default function contribute(plugin: unknown) {
const service = bindTestSessionHost(
new PluginService(pino({ level: "silent" }), store, "0.4.0"),
);
await service.start();
await service.installDirectory({ path: first });
await service.installDirectory({ path: second });
try {
await service.start();
await service.installDirectory({ path: first });
await service.installDirectory({ path: second });
expect(catalogIds(service)).toEqual(["first", "second"]);
await store.patch({ pluginsEnabled: false });
await store.patch({ pluginsEnabled: false });
expect(service.catalog()).toEqual([]);
await expect(service.invokePluginRpc("second", "anything", {})).rejects.toThrow(
"Plugin is not available",
);
await store.patch({ pluginsEnabled: true });
await service.reloadPlugin("first");
expect((await service.listPlugins()).map(({ id, status }) => ({ id, status }))).toEqual([
{ id: "first", status: "running" },
{ id: "second", status: "running" },
]);
await service.stopAllPlugins();
expect(service.catalog()).toEqual([]);
await expect(service.invokePluginRpc("second", "anything", {})).rejects.toThrow(
"Plugin is not available",
);
await store.patch({ pluginsEnabled: true });
// Observe recovery itself. Reloading here restarts a healthy plugin and
// would also conceal a failure to restart it after the global enable.
await expect
.poll(() => service.listPlugins(), { timeout: 10_000 })
.toMatchObject([
{ id: "first", status: "running" },
{ id: "second", status: "running" },
]);
} finally {
await service.stopAllPlugins();
}
}, 20_000);
it("does not publish an in-flight start after a later global disable", async () => {