Debian Codegraph @

tests/functional/optional-outputs/03-c7backcompat.t

raw
1 #!/usr/bin/env bash
2 # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
3 # Copyright (C) NIWA & British Crown (Met Office) & Contributors.
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #-------------------------------------------------------------------------------
18
19 # Check Cylc 7 backward compatibility for success/fail branching.
20
21 # A bunch of unit tests in test_graph_parser.py check that outputs are handled
22 # the same for a wide variety of graphs. This functional test should be
23 # sufficient to check the resulting validation and run time behaviour.
24
25 . "$(dirname "$0")/test_header"
26 set_test_number 5
27
28 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
29
30 TEST_NAME="${TEST_NAME_BASE}-validate_as_c8"
31 run_fail "${TEST_NAME}" cylc validate "${WORKFLOW_NAME}"
32
33 ERR="GraphParseError: Opposite outputs .* must both be optional if both are used"
34 grep_ok "${ERR}" "${TEST_NAME}.stderr"
35
36 # Rename config to "suite.rc"
37 mv "${WORKFLOW_RUN_DIR}/flow.cylc" "${WORKFLOW_RUN_DIR}/suite.rc"
38 ln -s "${WORKFLOW_RUN_DIR}/suite.rc" "${WORKFLOW_RUN_DIR}/flow.cylc"
39 # It should now validate, with a deprecation message
40 TEST_NAME="${TEST_NAME_BASE}-validate_as_c7"
41 run_ok "${TEST_NAME}" cylc validate "${WORKFLOW_NAME}"
42
43 DEPR_MSG_1=$(python -c \
44 'from cylc.flow.workflow_files import SUITERC_DEPR_MSG; print(SUITERC_DEPR_MSG)')
45 grep_ok "${DEPR_MSG_1}" "${TEST_NAME}.stderr"
46
47 # And it should run without stalling with an incomplete task.
48 workflow_run_ok "${TEST_NAME_BASE}-run" \
49 cylc play --no-detach --reference-test --debug "${WORKFLOW_NAME}"
50
51 purge
52 exit