feat: complete reliable coordination adapter
Some checks failed
tamq-ci / test (push) Failing after 5s
Some checks failed
tamq-ci / test (push) Failing after 5s
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a03397-4d51-7fd1-8ff2-946eb22ea2bc
This commit is contained in:
parent
25113f463e
commit
6d2ccc7760
30 changed files with 2553 additions and 144 deletions
27
tests/test_retry.py
Normal file
27
tests/test_retry.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from tamq.cli import main
|
||||
from tamq.store import Store
|
||||
|
||||
|
||||
def test_retry_cli_resets_only_terminal_failures(tmp_path, monkeypatch, capsys):
|
||||
state = tmp_path / "state"
|
||||
monkeypatch.setenv("TAMQ_STATE_DIR", str(state))
|
||||
store = Store(state / "tamq.sqlite3")
|
||||
failed = store.add("a", "b", "failed")
|
||||
pending = store.add("a", "b", "pending")
|
||||
store.db.execute(
|
||||
"UPDATE messages SET state='failed',attempt_count=4,last_failure_reason='OSError' "
|
||||
"WHERE message_id=?",
|
||||
(failed,),
|
||||
)
|
||||
store.db.commit()
|
||||
store.close()
|
||||
|
||||
assert main(["retry", failed]) == 0
|
||||
assert capsys.readouterr().out.strip() == failed
|
||||
reopened = Store(state / "tamq.sqlite3")
|
||||
assert reopened.message(failed)["state"] == "pending"
|
||||
assert reopened.message(failed)["attempt_count"] == 0
|
||||
reopened.close()
|
||||
|
||||
assert main(["retry", pending]) == 1
|
||||
assert "not failed" in capsys.readouterr().err
|
||||
Loading…
Add table
Add a link
Reference in a new issue