-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test that Cylc VR unsets the --against-source mode after validation.
- Loading branch information
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
tests/functional/cylc-combination-scripts/08-vr-against-src.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env bash | ||
# 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/>. | ||
|
||
#------------------------------------------------------------------------------ | ||
# Test `cylc vr` (Validate Reinstall restart) | ||
# Tests that VR doesn't modify the source directory for Cylc play. | ||
# See https://github.com/cylc/cylc-flow/issues/6209 | ||
|
||
. "$(dirname "$0")/test_header" | ||
set_test_number 8 | ||
|
||
# Setup (Run VIP, check that the play step fails in the correct way): | ||
WORKFLOW_NAME="cylctb-x$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6)" | ||
cp "${TEST_SOURCE_DIR}/vr_workflow_fail_on_play/flow.cylc" . | ||
|
||
# Run Cylc VIP | ||
export THIS_TEST_RUN="1" | ||
run_fail "setup (vip)" \ | ||
cylc vip --debug \ | ||
--workflow-name "${WORKFLOW_NAME}" \ | ||
--no-run-name \ | ||
-s 'fatal_flaw="true"' | ||
validate1="$(grep -Po "WARNING - vip:(.*)" "setup (vip).stderr" | awk -F ':' '{print $2}')" | ||
play1="$(grep -Po "WARNING - play:(.*)" "setup (vip).stderr" | awk -F ':' '{print $2}')" | ||
|
||
# Change the workflow to make the reinstall happen: | ||
echo "" >> flow.cylc | ||
|
||
# Run Cylc VR: | ||
TEST_NAME="${TEST_NAME_BASE}" | ||
run_fail "${TEST_NAME}" cylc vr "${WORKFLOW_NAME}" -s 'fatal_flaw="true"' | ||
validate2="$(grep -Po "WARNING - vr:(.*)" "${TEST_NAME_BASE}.stderr" | awk -F ':' '{print $2}')" | ||
play2="$(grep -Po "WARNING - play:(.*)" "${TEST_NAME_BASE}.stderr" | awk -F ':' '{print $2}')" | ||
|
||
# Test that the correct source directory is openened at different | ||
# stages of Cylc VIP & VR | ||
TEST_NAME="vip validate and play operate on different folders" | ||
[[ $validate1 != $play1 ]] && ok "${TEST_NAME}" || fail "${TEST_NAME}" | ||
TEST_NAME="vr & vip validate operate on the same folder" | ||
[[ $validate1 == $validate2 ]] && ok "${TEST_NAME}" || fail "${TEST_NAME}" | ||
TEST_NAME="vr validate and play operate on different folders" | ||
[[ $validate2 != $play2 ]] && ok "${TEST_NAME}" || fail "${TEST_NAME}" | ||
TEST_NAME="vip play loads from a cylc-run subdir" | ||
[[ $play2 =~ 'cylc-run' ]] && ok "${TEST_NAME}" || fail "${TEST_NAME}" | ||
TEST_NAME="vr play loads from a cylc-run subdir" | ||
[[ $play2 =~ "cylc-run" ]] && ok "${TEST_NAME}" || fail "${TEST_NAME}" | ||
|
||
# Clean Up: | ||
run_ok "${TEST_NAME_BASE}-stop cylc stop ${WORKFLOW_NAME} --now --now" | ||
purge | ||
exit 0 |
19 changes: 19 additions & 0 deletions
19
tests/functional/cylc-combination-scripts/vr_workflow_fail_on_play/flow.cylc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!jinja2 | ||
{% from "sys" import argv %} | ||
{% from "cylc.flow" import LOG %} | ||
{% from "pathlib" import Path %} | ||
{% if argv[1] == "play" %} | ||
this = should cause cylc play to fail | ||
{% endif %} | ||
|
||
{% set SPATH = Path.cwd().__str__() %} | ||
{% do LOG.warning(argv[1] + ":" + SPATH) %} | ||
|
||
|
||
[scheduling] | ||
initial cycle point = 1500 | ||
[[graph]] | ||
P1Y = foo | ||
|
||
[runtime] | ||
[[foo]] |