fix: bump spawn-test timeouts to avoid CI flakiness (closes #12)
The crashed/exited/stderr spawn tests used 0.3-0.5s timeouts. On a slow CI runner, interpreter startup can exceed that, so the process is still starting when the timeout fires, gets killed, and is misclassified "ok" (still running) instead of "crashed"/"exited". Bump those three to 2.0s. The two "ok" paths (sleep-60, stdin-block) stay at 0.3s since timing out there means success.
This commit is contained in:
+8
-5
@@ -256,17 +256,20 @@ def test_spawn_test_ok_still_running():
|
||||
|
||||
|
||||
def test_spawn_test_crashed():
|
||||
# A process that exits with a non-zero code immediately
|
||||
# A process that exits with a non-zero code immediately.
|
||||
# Timeout is generous (not 0.3s) so a slow CI runner's interpreter startup
|
||||
# can't outlast it and misclassify the crash as "ok" (still running). See #12.
|
||||
r = c.spawn_test(
|
||||
{"command": sys.executable, "args": ["-c", "raise SystemExit(1)"]}, timeout=0.3
|
||||
{"command": sys.executable, "args": ["-c", "raise SystemExit(1)"]}, timeout=2.0
|
||||
)
|
||||
assert r["outcome"] == "crashed"
|
||||
assert r["returncode"] == 1
|
||||
|
||||
|
||||
def test_spawn_test_exited_cleanly():
|
||||
# A process that exits 0 before timeout (unusual for a server)
|
||||
r = c.spawn_test({"command": sys.executable, "args": ["-c", "pass"]}, timeout=0.5)
|
||||
# A process that exits 0 before timeout (unusual for a server).
|
||||
# Generous timeout so slow-runner startup can't flip this to "ok". See #12.
|
||||
r = c.spawn_test({"command": sys.executable, "args": ["-c", "pass"]}, timeout=2.0)
|
||||
assert r["outcome"] == "exited"
|
||||
assert r["returncode"] == 0
|
||||
|
||||
@@ -288,7 +291,7 @@ def test_spawn_test_stderr_captured():
|
||||
"command": sys.executable,
|
||||
"args": ["-c", "import sys; sys.stderr.write('test-err\\n'); sys.exit(2)"],
|
||||
},
|
||||
timeout=0.5,
|
||||
timeout=2.0,
|
||||
)
|
||||
assert r["outcome"] == "crashed"
|
||||
assert "test-err" in r["stderr"]
|
||||
|
||||
Reference in New Issue
Block a user