Skip to content

Commit

Permalink
Test errors are handled
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottWales committed Dec 3, 2024
1 parent 656c275 commit 2ae8bb3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
2 changes: 0 additions & 2 deletions cylc/flow/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ async def reload_workflow(schd: 'Scheduler', reload_global: bool = False):
# give commands time to complete
sleep(1) # give any remove-init's time to complete


if reload_global:
# Reload global config if requested
LOG.info("Reloading the global configuration.")
Expand All @@ -384,7 +383,6 @@ async def reload_workflow(schd: 'Scheduler', reload_global: bool = False):
' again.'
)


# reload the workflow definition
schd.reload_pending = 'loading the workflow definition'
schd.update_data_store() # update workflow status msg
Expand Down
38 changes: 30 additions & 8 deletions tests/integration/test_reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,18 @@ async def test_reload_global(
""")
assert glbl_cfg(reload=True).get(['platforms','localhost','meta','x']) == '1'

# Modify the global config file
global_config_path.write_text("""
[platforms]
[[localhost]]
[[[meta]]]
x = 2
""")

id_ = flow(one_conf)
schd = scheduler(id_)
async with start(schd) as log:

# Modify the global config file
global_config_path.write_text("""
[platforms]
[[localhost]]
[[[meta]]]
x = 2
""")

# reload the workflow and global config
await commands.run_cmd(commands.reload_workflow, schd, reload_global=True)

Expand All @@ -196,3 +196,25 @@ async def test_reload_global(

# Task platforms reflect the new config
assert schd.pool.get_tasks()[0].platform['meta']['x'] == '2'

# Modify the global config file with an error
global_config_path.write_text("""
[ERROR]
[[localhost]]
[[[meta]]]
x = 3
""")

# reload the workflow and global config
await commands.run_cmd(commands.reload_workflow, schd, reload_global=True)

# Error is noted in the log
assert log_filter(
log,
contains=(
'This is probably due to an issue with the new configuration.'
)
)

# Task platforms should be the last valid value
assert schd.pool.get_tasks()[0].platform['meta']['x'] == '2'

0 comments on commit 2ae8bb3

Please sign in to comment.