Skip to content

Commit

Permalink
SQ -> Bulkheads: If scheduler thread or root task crashes, display "S…
Browse files Browse the repository at this point in the history
…cheduler crashed" top-level task
  • Loading branch information
davidfstr committed Feb 23, 2024
1 parent 5c8317a commit 0a581fb
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/crystal/tests/test_bulkheads.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
from crystal.tests.util.skip import skipTest
from crystal.tests.util.tasks import (
append_deferred_top_level_tasks,
clear_top_level_tasks_on_exit, scheduler_disabled, scheduler_thread_context,
clear_top_level_tasks_on_exit,
first_task_title_progression,
scheduler_disabled, scheduler_thread_context,
ttn_for_task,
)
from crystal.tests.util.wait import (
first_child_of_tree_item_is_not_loading_condition,
wait_for,
wait_for, wait_while,
)
from crystal.tests.util.windows import OpenOrCreateDialog
from crystal.model import Project, Resource, ResourceGroup, RootResource
Expand Down Expand Up @@ -1417,7 +1419,19 @@ def scheduler_sleep(*args, **kwargs) -> None:
home_r = Resource(project, home_url)
home_r.download()

await wait_for(lambda: (root_task.crash_reason is not None) or None)
first_task_title = first_task_title_progression(mw.task_tree)
def progression_func():
if root_task.crash_reason is not None:
# Stop
return None
else:
# Keep waiting while first task title is changing
title = first_task_title()
if title is None:
return '(waiting for first task to start)'
else:
return title
await wait_while(progression_func)

# Postconditions
assert scheduler_sleep.called # type: ignore[attr-defined]
Expand Down

0 comments on commit 0a581fb

Please sign in to comment.