Files
claude-config/bin/do_epic/e2e/main.py
T

41 lines
1.7 KiB
Python

"""The do-epic-e2e command: runs do-epic's commands that need no tmux session and no worker against a sandbox epic on a real Jira site (docs/decisions.md → `do-epic: drives one Jira epic …`). It is no part of `run-tests`."""
import pathlib
import sys
import typing
from do_epic.e2e import sandbox, scenario, settings
from failure import Failure
HELP = f"""usage: do-epic-e2e
Makes an epic in the Jira sandbox, with issues and sub-tasks, drives do-epic against it and deletes it, whatever the outcome.
It reads three environment variables and fails, naming each that is missing:
{chr(10).join(f' {name}: {meaning}' for name, meaning in settings.MEANING.items())}
It prints a line per check, and exits 0 only where every check held."""
def main(argv: list[str], env: typing.Mapping[str, str], launcher: pathlib.Path) -> int:
if argv:
print(HELP, file=sys.stdout if argv in (["-h"], ["--help"]) else sys.stderr)
return 0 if argv in (["-h"], ["--help"]) else 1
found = settings.read(env)
if isinstance(found, Failure):
print(f"do-epic-e2e cannot start: {found.reason}", file=sys.stderr)
return 1
try:
with sandbox.epic_made(found, "do-epic e2e sandbox epic") as key:
if isinstance(key, Failure):
print(f"do-epic-e2e: {key.reason}", file=sys.stderr)
return 1
print(f"Sandbox epic {key} in {found.jira_url}")
report = scenario.run(found, key, launcher)
except sandbox.Leftover as left:
print(f"do-epic-e2e: {left}", file=sys.stderr)
return 1
for line in report.held:
print(f"ok {line}")
for line in report.broke:
print(f"FAIL {line}")
print(f"{len(report.held)} held, {len(report.broke)} broke; the sandbox epic is deleted")
return 1 if report.broke else 0