test: bypass real polling loops in job timeout tests and adjust timeout parameter
This commit is contained in:
@@ -1036,6 +1036,8 @@ def test_job_wait_for_ip_timeout(
|
|||||||
"""When _wait_for_ip returns None the job raises 'timeout waiting for guest IP'."""
|
"""When _wait_for_ip returns None the job raises 'timeout waiting for guest IP'."""
|
||||||
backend = _FakeBackend(running_after=0, ip=None)
|
backend = _FakeBackend(running_after=0, ip=None)
|
||||||
_patch_common(monkeypatch, backend)
|
_patch_common(monkeypatch, backend)
|
||||||
|
# Bypass the real polling loop — we test the consequence, not the loop.
|
||||||
|
monkeypatch.setattr(job_module, "_wait_for_ip", lambda *_a, **_k: None)
|
||||||
|
|
||||||
result = CliRunner().invoke(
|
result = CliRunner().invoke(
|
||||||
cli,
|
cli,
|
||||||
@@ -1054,7 +1056,9 @@ def test_job_transport_probe_timeout(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""_probe_transport returning False → 'timeout waiting for guest transport'."""
|
"""_probe_transport returning False → 'timeout waiting for guest transport'."""
|
||||||
backend = _FakeBackend(running_after=0)
|
backend = _FakeBackend(running_after=0)
|
||||||
_patch_common(monkeypatch, backend, transport_ready=False)
|
_patch_common(monkeypatch, backend)
|
||||||
|
# Bypass the real probe loop — we test the consequence, not the loop.
|
||||||
|
monkeypatch.setattr(job_module, "_probe_transport", lambda **_k: False)
|
||||||
|
|
||||||
result = CliRunner().invoke(
|
result = CliRunner().invoke(
|
||||||
cli,
|
cli,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ def test_acquire_exhausted_raises(tmp_path: Path) -> None:
|
|||||||
pool = make_pool(tmp_path, addresses=["10.0.0.1"])
|
pool = make_pool(tmp_path, addresses=["10.0.0.1"])
|
||||||
pool.acquire("owner-1")
|
pool.acquire("owner-1")
|
||||||
with pytest.raises(RuntimeError, match="exhausted"):
|
with pytest.raises(RuntimeError, match="exhausted"):
|
||||||
pool.acquire("owner-2", timeout=0.1)
|
pool.acquire("owner-2", timeout=0)
|
||||||
|
|
||||||
|
|
||||||
# ── release ──────────────────────────────────────────────────────────────────
|
# ── release ──────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user