Test the human's task under the automation switch, a repeated failed read and the list of statuses in the wait line
CI / tests (pull_request) Successful in 2m55s
CI / tests (pull_request) Successful in 2m55s
This commit is contained in:
@@ -11,6 +11,7 @@ from do_epic.test_main import DESCRIPTION, Description, DoEpicTest, MODELS, UNRE
|
||||
from do_epic.epic_record import EpicRecord
|
||||
from failure import Failure
|
||||
from loop_effects.doubles import FakeEffects
|
||||
from do_epic.human_tasks import holds_up
|
||||
from do_epic.scheduler import HUMAN_WAIT
|
||||
from do_epic.test_scheduler import issue
|
||||
from do_epic.backend.fake import MemoryEpic
|
||||
@@ -49,9 +50,10 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest):
|
||||
self.slept = slept
|
||||
return self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS)
|
||||
|
||||
def test_a_task_the_human_moves_to_an_unblocking_status_no_longer_holds_up_an_issue(self) -> None:
|
||||
def moved_to_an_unblocking_status(self, switch: str) -> bool:
|
||||
"""Whether Jira counts the task done after its window's run, where the human moved it to an unblocking status and the config ends with switch."""
|
||||
with (self.home / ".claude-projects" / "do-epic" / "config.toml").open("a") as config:
|
||||
config.write('jira-unblocking-statuses = ["Release Ready"]\n')
|
||||
config.write('jira-unblocking-statuses = ["Release Ready"]\n' + switch)
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
slept: list[int] = []
|
||||
|
||||
@@ -64,6 +66,17 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest):
|
||||
code, out, err = self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual((code, err, slept), (0, "", [60, 60]))
|
||||
self.assertIn("the chunk finished; started ABC-21\n", out)
|
||||
return next(each.done for each in self.epic.issues if each.key == "ABC-19")
|
||||
|
||||
def test_a_task_the_human_moves_to_an_unblocking_status_no_longer_holds_up_an_issue_and_moves_to_done(self) -> None:
|
||||
self.assertTrue(self.moved_to_an_unblocking_status(""))
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_the_humans_task_stays_where_the_human_moved_it(self) -> None:
|
||||
self.assertFalse(self.moved_to_an_unblocking_status("jira-automation-moves-issues = true\n"))
|
||||
|
||||
def test_a_task_holds_up_only_the_issues_no_unblocking_status_settles(self) -> None:
|
||||
issues = [issue("ABC-19", "do-epic-human"), issue("ABC-20", "do-epic-claude", blockers=("ABC-19",), status="Release Ready"), issue("ABC-21", "do-epic-claude", blockers=("ABC-19",))]
|
||||
self.assertEqual(holds_up("ABC-19", issues, {}, ("Release Ready",)), ["ABC-21"])
|
||||
|
||||
def test_dms_the_human_once_parks_its_window_and_polls_until_the_issue_closes_then_starts_the_next(self) -> None:
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
|
||||
@@ -776,7 +776,7 @@ class AChunkWhosePullRequestWaitsOnAGate(DoEpicTest):
|
||||
self.assertEqual((code, len(prompts)), (0, 1), err)
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_a_finished_chunk_in_a_repo_moves_none_and_waits_for_the_move(self) -> None:
|
||||
(self.home / ".claude-projects" / "do-epic" / "config.toml").write_text(SETTINGS + 'jira-unblocking-statuses = ["Release Ready"]\njira-automation-moves-issues = true\n', encoding="utf-8")
|
||||
(self.home / ".claude-projects" / "do-epic" / "config.toml").write_text(SETTINGS + 'jira-unblocking-statuses = ["Release Ready", "Shipped"]\njira-automation-moves-issues = true\n', encoding="utf-8")
|
||||
store = MemoryEpic("ABC-12", [*self.issues[:-1], issue("ABC-22", "do-epic-claude", blockers=("ABC-20",))])
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[method-assign,arg-type]
|
||||
self.forges = [awaiting(pulls="")]
|
||||
@@ -785,15 +785,15 @@ class AChunkWhosePullRequestWaitsOnAGate(DoEpicTest):
|
||||
|
||||
def sleep(seconds: float) -> None:
|
||||
slept.append(seconds)
|
||||
store.fails = "Jira answered 503" if len(slept) == 1 else None
|
||||
if len(slept) == 3:
|
||||
store.fails = "Jira answered 503" if len(slept) in (1, 2) else None
|
||||
if len(slept) == 4:
|
||||
store.change("ABC-20", status="Release Ready")
|
||||
fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=sleep) # type: ignore[method-assign]
|
||||
code, out, err, _ = self.parked_run(fake)
|
||||
self.assertEqual((code, slept), (0, [60, 60, 60]), err)
|
||||
self.assertIn("cannot read the epic, so cannot tell whether ABC-20 has moved; trying again every 60 seconds: Jira answered 503\n", out)
|
||||
self.assertEqual((code, slept), (0, [60, 60, 60, 60]), err)
|
||||
self.assertEqual(out.count("cannot read the epic, so cannot tell whether ABC-20 has moved; trying again every 60 seconds: Jira answered 503\n"), 1, out)
|
||||
self.assertEqual([(each.status, each.done) for each in store.issues if each.key == "ABC-20"], [("Release Ready", False)])
|
||||
self.assertEqual(out.count("ABC-20 is To Do: it waits for the team's automation to move it to Release Ready; move it in Jira if the automation doesn't\n"), 1, out)
|
||||
self.assertEqual(out.count("ABC-20 is To Do: it waits for the team's automation to move it to Release Ready or Shipped; move it in Jira if the automation doesn't\n"), 1, out)
|
||||
self.assertIn("the chunk finished; started ABC-22\n", out)
|
||||
|
||||
def test_where_the_chunk_merges_an_approved_pull_request_parks_no_chunk(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user