test(autonomous-release): verify candidate CLI workflows
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from aios_autonomous_release_candidate.cli import main
|
||||
|
||||
|
||||
def test_cli_artifact_build_and_verify(tmp_path: Path, capsys) -> None:
|
||||
source = tmp_path / "source"
|
||||
source.mkdir()
|
||||
(source / "payload.txt").write_text("candidate payload\n", encoding="utf-8")
|
||||
output = tmp_path / "output"
|
||||
assert main(
|
||||
[
|
||||
"artifact",
|
||||
"build",
|
||||
"--source",
|
||||
str(source),
|
||||
"--source-oid",
|
||||
"a" * 40,
|
||||
"--tree-oid",
|
||||
"b" * 40,
|
||||
"--output-directory",
|
||||
str(output),
|
||||
]
|
||||
) == 0
|
||||
built = json.loads(capsys.readouterr().out)
|
||||
assert built["secrets_included"] is False
|
||||
assert main(
|
||||
[
|
||||
"artifact",
|
||||
"verify",
|
||||
"--artifact",
|
||||
built["artifact"],
|
||||
"--manifest",
|
||||
built["manifest"],
|
||||
]
|
||||
) == 0
|
||||
assert json.loads(capsys.readouterr().out)["verified"] is True
|
||||
|
||||
|
||||
def test_cli_release_verify_stops_at_owner(tmp_path: Path, capsys) -> None:
|
||||
payload = {
|
||||
"task_id": "cli-release-task",
|
||||
"repository": "aios/aios",
|
||||
"branch": "integration/cli-release",
|
||||
"version": "SHADOW-0.1.0",
|
||||
"target_oid": "a" * 40,
|
||||
"tree_oid": "b" * 40,
|
||||
"artifact_sha256": "c" * 64,
|
||||
"manifest_sha256": "d" * 64,
|
||||
"package_closure_sha256": "e" * 64,
|
||||
"evidence_closure_oid": "f" * 40,
|
||||
"approval_plan_id": "external-owner-release",
|
||||
"rollback_approval_plan_id": "external-owner-rollback",
|
||||
"rollback_artifact_sha256": "1" * 64,
|
||||
"expected_tag_oid": "2" * 40,
|
||||
"expected_target_oid": "a" * 40,
|
||||
"production_config_sha256": "3" * 64,
|
||||
}
|
||||
path = tmp_path / "release-plan.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
assert main(["release", "verify", "--payload", str(path)]) == 0
|
||||
result = json.loads(capsys.readouterr().out)
|
||||
assert result["release_state"] == "WAITING_OWNER"
|
||||
assert result["production_release"] == "BLOCKED_EXTERNAL_OWNER_SIGNATURE"
|
||||
assert result["production_side_effects"] is False
|
||||
Reference in New Issue
Block a user