Skip to content

Commit c5c9332

Browse files
committed
tests: Reduce test flakiness on macOS
On Linux systems, we use `/proc/$pid/syscall` to wait until the tracked process is blocked in the `connect` or `accept` call we want to interrupt. There's no analogous mechanism on macOS, so we just sleep there. On the GitHub Actions macOS runners, sometimes this delay is not long enough. Increase it to try to reduce test flakiness. Signed-off-by: Matt Wozniski <godlygeek@gmail.com>
1 parent 11663b8 commit c5c9332

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/integration/test_main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ def track_and_wait(output_dir, sleep_after=100):
8282

8383

8484
def _wait_until_process_blocks(pid: int) -> None:
85+
# Sleep longer on GitHub Actions macOS runners to reduce test flakiness
86+
default_sleep = 5.0 if "GITHUB_ACTIONS" in os.environ else 1.0
8587
if "linux" not in sys.platform:
86-
time.sleep(1.0)
88+
time.sleep(default_sleep)
8789
return
8890
# Signal numbers from https://filippo.io/linux-syscall-table/
8991
arch = platform.machine()
@@ -100,7 +102,7 @@ def _wait_until_process_blocks(pid: int) -> None:
100102
else:
101103
# No idea what syscalls numbers to wait on, so we will just
102104
# sleep for a long enough period and hope for the best
103-
time.sleep(1.0)
105+
time.sleep(default_sleep)
104106
return
105107
syscalls_to_wait = {sleep_syscall, clock_nanosleep, connect_syscall, accept_syscall}
106108
current_syscall = ""

0 commit comments

Comments
 (0)