fix(sre): allow exact clawbot stop contract
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m38s
CD Pipeline / build-and-deploy (push) Successful in 14m56s
CD Pipeline / post-deploy-checks (push) Successful in 2m22s

This commit is contained in:
ogt
2026-07-17 08:52:57 +08:00
parent 29fe0b4958
commit 1f3da4ba1e
2 changed files with 44 additions and 6 deletions

View File

@@ -213,6 +213,29 @@ def test_openclaw_playbook_is_check_first_bounded_and_rollback_capable() -> None
assert tasks["Fail closed when systemd source identity is outside host188 scope"][
"ansible.builtin.assert"
]["that"] == ["openclaw_workdir in allowed_working_directories"]
systemd_fields = tasks[
"Pin bounded systemd start and stop contracts separately"
]["ansible.builtin.set_fact"]
assert "^ExecStart=" in systemd_fields["clawbot_exec_start_line"]
assert "^ExecStop=" in systemd_fields["clawbot_exec_stop_line"]
systemd_contract = tasks[
"Require the existing systemd-owned Compose up contract"
]["ansible.builtin.assert"]["that"]
assert (
"'argv[]=/usr/bin/docker compose up -d ;' in clawbot_exec_start_line"
in systemd_contract
)
assert (
"'argv[]=/usr/bin/docker compose down ;' in clawbot_exec_stop_line"
in systemd_contract
)
assert (
"' down ' not in (' ' ~ clawbot_exec_start_line ~ ' ')"
in systemd_contract
)
assert "' down ' not in (' ' ~ clawbot_systemd_shape.stdout ~ ' ')" not in (
systemd_contract
)
check_receipt = tasks["Publish check-mode overlay diff and no-write receipt"]
assert check_receipt["when"] == "ansible_check_mode"