Skip to content

Commit

Permalink
tests/i: test preparing tasks are reset to waiting on restart
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Feb 10, 2022
1 parent 67cba6a commit b0f092a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/integration/test_task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,34 @@ async def test_trigger_states(status, should_trigger, one, run):

# check whether the task triggered
assert task.is_manual_submit == should_trigger


async def test_preparing_tasks_on_restart(one_conf, flow, scheduler, run):
"""Preparing tasks should be reset to waiting on restart.
This forces preparation to be re-done on restart so that it uses the
new configuration.
See discussion on: https://github.com/cylc/cylc-flow/pull/4668
"""
id_ = flow(one_conf)

# start the workflow, reset a task to preparing
one = scheduler(id_)
async with run(one):
task = one.pool.filter_task_proxies(['*'])[0][0]
task.state.reset(TASK_STATUS_PREPARING)

# when we restart the task should have been reset to waiting
one = scheduler(id_)
async with run(one):
task = one.pool.filter_task_proxies(['*'])[0][0]
assert task.state(TASK_STATUS_WAITING)
task.state.reset(TASK_STATUS_SUCCEEDED)

# whereas if we reset the task to succeeded the state is not reset
one = scheduler(id_)
async with run(one):
task = one.pool.filter_task_proxies(['*'])[0][0]
assert task.state(TASK_STATUS_SUCCEEDED)

0 comments on commit b0f092a

Please sign in to comment.