fix(issue-33): subscriber exit codes are named on both sides; wait keeps a spent budget at rc 2; G-8 is deterministic
- job_subscriber.py returns only named codes (RC_COMPLETED 0, RC_ERROR 1, RC_NO_EVENT 2, RC_BROKER_UNAVAILABLE 3, RC_WALL_CLOCK 4). The wrapper mirrors them as SUB_RC_* and compares subscriber codes only by name; a test keeps the mirror equal to the Python constants and forbids numeric comparisons of $sub_rc/$sub_exit and numeric `return` in the subscriber. - `delegate-job wait` passed the subscriber's code straight through, so a spent budget would have reached its callers as 4; it is 2 again (B7 fails without the mapping). - tier1 G-8 gave both clocks 0.5 s and raced; the wall clock now runs out first by construction (idle 30 s) and the test asserts RC_WALL_CLOCK. Other subscriber rc asserts use the names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9ec0569401
commit
1673818bb5
6 files changed
+77
-37
No files matched your search
@@ -341,3 +341,18 @@ def test_r3_a_budget_spent_waiting_on_an_unreachable_broker_is_wall_clock_timeou
|
||||
if p.poll() is None:
|
||||
p.kill()
|
||||
p.communicate(timeout=10)
|
||||
|
||||
|
||||
|
||||
# Issue #33 follow-up (job 60da22f6): `delegate-job wait` passes the subscriber's
|
||||
# code through; a spent budget stays rc 2 for its callers, as before the split.
|
||||
@pytest.mark.parametrize("state,rc", [("running", 2), ("completed", 0)])
|
||||
def test_b7_wait_keeps_a_spent_budget_at_rc_2(tmp_path, state, rc):
|
||||
env = _env(tmp_path, broker=True)
|
||||
reg = tmp_path / "reg"
|
||||
jid = _jid(_dry_submit(env, reg))
|
||||
if state == "completed":
|
||||
_publish(env, reg, jid, "completed")
|
||||
res = subprocess.run(["bash", str(WRAPPER), "wait", "--job", jid, "--registry-dir", str(reg), "--timeout", "2"],
|
||||
capture_output=True, text=True, env=env, cwd=env["HOME"], timeout=60)
|
||||
assert res.returncode == rc, res.stdout + res.stderr
|
||||
Reference in new issue
Block a user