mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-08 01:14:52 +00:00
test(desktop): cover a daemon stopping during startup
Keep incomplete host registration out of startup recovery when a delayed daemon exits before readiness. Co-authored-by: magiclaw <930198090@qq.com>
This commit is contained in:
co-authored by
magiclaw
parent
f42926cffb
commit
b3b72b1550
@@ -64,6 +64,24 @@ function makeRelayOnlyHost(serverId: string): HostProfile {
|
||||
}
|
||||
|
||||
describe("DaemonStartService", () => {
|
||||
it("reports a daemon that stops during startup without registering an incomplete host", async () => {
|
||||
const fake = createFakeStore();
|
||||
const service = new DaemonStartService({
|
||||
store: fake.store,
|
||||
startDesktopDaemon: async () =>
|
||||
makeStatus({ status: "starting", serverId: "", listen: null }),
|
||||
getDesktopDaemonStatus: async () =>
|
||||
makeStatus({ status: "stopped", serverId: "", listen: null, pid: null }),
|
||||
});
|
||||
|
||||
expect(await service.start()).toEqual({
|
||||
ok: false,
|
||||
error: "The local daemon stopped before startup completed.",
|
||||
});
|
||||
expect(service.isRunning()).toBe(false);
|
||||
expect(fake.upserts).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps startup pending until a slow daemon becomes ready without restarting it", async () => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user