mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 04:29:27 +00:00
test(plane): task-timeout test leaves room for apply and resume under host load
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
73f9725103
commit
709320be7d
@@ -545,11 +545,13 @@ def test_a_task_that_vanishes_before_delivery_is_failed(fake: Fake, tmp_path: Pa
|
|||||||
|
|
||||||
|
|
||||||
def test_no_delivery_within_the_task_timeout_is_failed(fake: Fake, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_no_delivery_within_the_task_timeout_is_failed(fake: Fake, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
monkeypatch.setenv("OUSAST_TASK_TIMEOUT", "0.5")
|
# The fake ax is a Python subprocess per call (~0.3-1 s under host load); the task must reach Running before the
|
||||||
|
# timeout, so leave room for apply + resume. 0.5 s raced that on a loaded host.
|
||||||
|
monkeypatch.setenv("OUSAST_TASK_TIMEOUT", "3")
|
||||||
fake.script({**SCRIPT, "repo-facts": {**SCRIPT["repo-facts"], "deliver": False}})
|
fake.script({**SCRIPT, "repo-facts": {**SCRIPT["repo-facts"], "deliver": False}})
|
||||||
started = time.monotonic()
|
started = time.monotonic()
|
||||||
assert reconciler.run(write_run(tmp_path, "silent"), ax=str(fake.ax)) == "failed"
|
assert reconciler.run(write_run(tmp_path, "silent"), ax=str(fake.ax)) == "failed"
|
||||||
assert time.monotonic() - started >= 0.5
|
assert time.monotonic() - started >= 3
|
||||||
reason = state_of("silent")["tasks"]["repo-facts"]["reason"]
|
reason = state_of("silent")["tasks"]["repo-facts"]["reason"]
|
||||||
assert "OUSAST_TASK_TIMEOUT" in reason and "Running" in reason, "Running forever is not completion"
|
assert "OUSAST_TASK_TIMEOUT" in reason and "Running" in reason, "Running forever is not completion"
|
||||||
assert [n for _, n in fake.events("delete")] == ["silent-repo-facts"], "ax delete follows every task"
|
assert [n for _, n in fake.events("delete")] == ["silent-repo-facts"], "ax delete follows every task"
|
||||||
|
|||||||
Reference in New Issue
Block a user