1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-09 07:39:15 -05:00

chore(cli): unflake signal test (#21185)

If these tests do eventually break, they'll time out.
This commit is contained in:
Matt Mastracci 2023-11-13 11:45:48 -07:00 committed by GitHub
parent 5fbf3d99a2
commit fe0d9e078f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,13 +122,15 @@ Deno.test(
await delay(20); await delay(20);
Deno.kill(Deno.pid, "SIGUSR1"); Deno.kill(Deno.pid, "SIGUSR1");
} }
await delay(20); await promise;
Deno.removeSignalListener("SIGUSR1", listener); Deno.removeSignalListener("SIGUSR1", listener);
resolve();
}); });
await promise; // We'll get three signals eventually
assertEquals(c, 3); while (c < 3) {
await delay(20);
}
resolve();
}, },
); );
@ -154,7 +156,9 @@ Deno.test(
await delay(20); await delay(20);
Deno.kill(Deno.pid, "SIGUSR2"); Deno.kill(Deno.pid, "SIGUSR2");
} }
await delay(20); while (c.length < 6) {
await delay(20);
}
Deno.removeSignalListener("SIGUSR2", listener1); Deno.removeSignalListener("SIGUSR2", listener1);
// Sends SIGUSR2 3 times. // Sends SIGUSR2 3 times.
for (const _ of Array(3)) { for (const _ of Array(3)) {
@ -167,7 +171,11 @@ Deno.test(
await delay(20); await delay(20);
Deno.kill(Deno.pid, "SIGUSR1"); Deno.kill(Deno.pid, "SIGUSR1");
} }
await delay(20);
while (c.length < 9) {
await delay(20);
}
Deno.removeSignalListener("SIGUSR2", listener0); Deno.removeSignalListener("SIGUSR2", listener0);
resolve(); resolve();
}); });