diff --git a/tests/test_issue18_liveness_contract.py b/tests/test_issue18_liveness_contract.py index e0d4033..db95f29 100644 --- a/tests/test_issue18_liveness_contract.py +++ b/tests/test_issue18_liveness_contract.py @@ -1220,9 +1220,16 @@ def test_acceptance5_remote_runner_completes_a_job_over_the_broker_only(tmp_path stdout, stderr = proc.communicate(timeout=180) jid = _wait_job_id(reg) if proc.returncode != 0: + if ("no CONNACK from broker" in stderr + and "published started" not in runner_log.read_text(errors="replace")): + pytest.skip("broker unreachable when publishing the dispatch (no CONNACK); the runner never saw the job") _skip_if_broker_did_not_deliver(reg, runner_log) assert proc.returncode == 0, f"rc={proc.returncode}\n{stdout}\n{stderr}\nrunner:\n{runner_log.read_text()}" - assert "subscriber received started" in stderr or "advanced to 'running'" in stderr + # delivery is confirmed by the protocol: the subscriber saw `started`, or + # the registry left pending - to running, or straight to completed when + # the broker delivered only the retained terminal event + assert ("subscriber received started" in stderr or "advanced to 'running'" in stderr + or "advanced to 'completed'" in stderr), stderr assert _job(reg, jid)["status"] == "completed", \ f"the subscriber mirrors the remote terminal into the registry\n{stdout}\n{stderr}\nrunner:\n{runner_log.read_text()}" assert _job(reg, jid)["transport"] == "remote"