Skip to content

Commit

Permalink
chore(cli): unflake signal test (denoland#21185)
Browse files Browse the repository at this point in the history
If these tests do eventually break, they'll time out.
  • Loading branch information
mmastrac committed Nov 13, 2023
1 parent 5fbf3d9 commit fe0d9e0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions cli/tests/unit/signal_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ Deno.test(
await delay(20);
Deno.kill(Deno.pid, "SIGUSR1");
}
await delay(20);
await promise;
Deno.removeSignalListener("SIGUSR1", listener);
resolve();
});

await promise;
assertEquals(c, 3);
// We'll get three signals eventually
while (c < 3) {
await delay(20);
}
resolve();
},
);

Expand All @@ -154,7 +156,9 @@ Deno.test(
await delay(20);
Deno.kill(Deno.pid, "SIGUSR2");
}
await delay(20);
while (c.length < 6) {
await delay(20);
}
Deno.removeSignalListener("SIGUSR2", listener1);
// Sends SIGUSR2 3 times.
for (const _ of Array(3)) {
Expand All @@ -167,7 +171,11 @@ Deno.test(
await delay(20);
Deno.kill(Deno.pid, "SIGUSR1");
}
await delay(20);

while (c.length < 9) {
await delay(20);
}

Deno.removeSignalListener("SIGUSR2", listener0);
resolve();
});
Expand Down

0 comments on commit fe0d9e0

Please sign in to comment.