Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test.sim mode changes on restart #5789

Merged
merged 4 commits into from
Dec 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Tests to ensure simulation mode is conserved across restarts of the s…
…cheduler.
  • Loading branch information
wxtim committed Oct 24, 2023
commit e5d9ba86e6d3be55b132253fbea9d8b739211e3c
47 changes: 47 additions & 0 deletions tests/integration/test_mode_on_restart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""What happens to the mode on restart?

+--------------------+--------+-------+-------+
| ↓restart \ start → | live | sim | dummy |
+====================+========+=======+=======+
| live | live | sim * | ??? |
| sim | live * | sim | ??? |
| dummy | ??? | ??? | dummy |
+--------------------+--------+-------+-------+

* A warning ought to be emitted, since the user doesn't otherwise know
what's happening.
"""

import pytest


@pytest.mark.parametrize('mode_before', (('live'), ('simulation')))
@pytest.mark.parametrize('mode_after', (('live'), ('simulation')))
async def test_restart_mode(
flow, scheduler, start, one_conf, mode_before, mode_after
):
"""Restarting a workflow in live mode leads to workflow in live mode
"""
id_ = flow(one_conf)
schd = scheduler(id_, run_mode=mode_before)
async with start(schd):
assert schd.config.run_mode() == mode_before

schd.options.run_mode = mode_after
async with start(schd):
assert schd.config.run_mode() == mode_before