| 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 |
# Test backwards compatibility for suite.rc files |
| 19 |
|
| 20 |
# Includes a test for warning about recurrence format 1 which changed |
| 21 |
# implementation - https://github.com/cylc/cylc-flow/pull/4554 |
| 22 |
|
| 23 |
. "$(dirname "$0")/test_header" |
| 24 |
set_test_number 3 |
| 25 |
|
| 26 |
init_suiterc() { |
| 27 |
local TEST_NAME="$1" |
| 28 |
local FLOW_CONFIG="${2:--}" |
| 29 |
WORKFLOW_NAME="${CYLC_TEST_REG_BASE}/${TEST_SOURCE_DIR_BASE}/${TEST_NAME}" |
| 30 |
mkdir -p "${TEST_DIR}/${WORKFLOW_NAME}/" |
| 31 |
cat "${FLOW_CONFIG}" >"${TEST_DIR}/${WORKFLOW_NAME}/suite.rc" |
| 32 |
cd "${TEST_DIR}/${WORKFLOW_NAME}" || exit |
| 33 |
} |
| 34 |
|
| 35 |
init_suiterc "${TEST_NAME_BASE}" <<'__FLOW__' |
| 36 |
[scheduler] |
| 37 |
allow implicit tasks = True |
| 38 |
[scheduling] |
| 39 |
initial cycle point = 2000 |
| 40 |
[[graph]] |
| 41 |
R2/2000/2001 = foo => bar |
| 42 |
__FLOW__ |
| 43 |
|
| 44 |
MSG=$(python -c 'from cylc.flow.workflow_files import SUITERC_DEPR_MSG; |
| 45 |
print(SUITERC_DEPR_MSG)') |
| 46 |
|
| 47 |
TEST_NAME="${TEST_NAME_BASE}-validate" |
| 48 |
run_ok "${TEST_NAME}" cylc validate . |
| 49 |
grep_ok "$MSG" "${TEST_NAME}.stderr" |
| 50 |
grep_ok "The recurrence 'R2/2000/2001' is unlikely to behave the same way as in Cylc 7 " \ |
| 51 |
"${TEST_NAME}.stderr" |