Debian Codegraph @

tests/functional/platforms/02-host-to-platform-upgrade.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 # Check that platform upgraders work sensibly.
19 # The following scenarios should be covered:
20 # - Task with no settings
21 # - Task with a host setting that should match the test platform
22 export REQUIRE_PLATFORM='loc:remote'
23 . "$(dirname "$0")/test_header"
24 set_test_number 7
25
26 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
27
28 # Ensure that a mix of syntax will fail.
29 run_fail "${TEST_NAME_BASE}-validate-fail" \
30 cylc validate "${TEST_SOURCE_DIR}/${TEST_NAME_BASE}/bad"
31 # and fail in this specific manner:
32 grep_ok "cannot be used with" "${TEST_NAME_BASE}-validate-fail.stderr"
33
34 # Ensure that you can validate workflow
35 run_ok "${TEST_NAME_BASE}-run" \
36 cylc validate "${WORKFLOW_NAME}" \
37 -s "CYLC_TEST_HOST='${CYLC_TEST_HOST}'" \
38 -s CYLC_TEST_HOST_FQDN="'$(ssh "$CYLC_TEST_HOST" hostname -f)'"
39
40 # Check that the cfgspec/workflow.py has issued a warning about upgrades.
41 grep_ok "\[t1\]\[remote\]host = ${CYLC_TEST_HOST}"\
42 "${TEST_NAME_BASE}-run.stderr"
43
44 # the namespace with the host setting will be logged not the task that
45 # inherits from it (because it happens in the cfgspec not the config)
46 grep_ok "\[T2\]\[remote\]host = ${CYLC_TEST_HOST}"\
47 "${TEST_NAME_BASE}-run.stderr"
48
49 # Run the workflow
50 workflow_run_ok "${TEST_NAME_BASE}-run" \
51 cylc play --debug --no-detach --reference-test \
52 -s CYLC_TEST_HOST="'$CYLC_TEST_HOST'" \
53 -s CYLC_TEST_HOST_FQDN="'$(ssh "$CYLC_TEST_HOST" hostname -f)'" \
54 "${WORKFLOW_NAME}"
55
56 grep "host=" "${WORKFLOW_RUN_DIR}/log/scheduler/log" > hosts.log
57
58 grep_ok "\[2/t2.*\].*host=${CYLC_TEST_HOST}" hosts.log
59
60 purge
61 exit