Debian Codegraph @

tests/f/intelligent-host-selection/00-mixedhost.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 # Test remote initialisation - where a task has a platform with an unreachable
19 # host.
20 export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp'
21
22 . "$(dirname "$0")/test_header"
23
24 #-------------------------------------------------------------------------------
25 set_test_number 4
26
27 # Uses a fake background job runner to get around the single host restriction.
28
29 create_test_global_config "" "
30 [platforms]
31 [[goodhostplatform]]
32 hosts = ${CYLC_TEST_HOST}
33 install target = ${CYLC_TEST_INSTALL_TARGET}
34 retrieve job logs = True
35
36 [[mixedhostplatform]]
37 job runner = my_background
38 hosts = unreachable_host, ${CYLC_TEST_HOST}
39 install target = ${CYLC_TEST_INSTALL_TARGET}
40 retrieve job logs = True
41 [[[selection]]]
42 method = 'definition order'
43 "
44 #-------------------------------------------------------------------------------
45
46 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
47
48 # Install the fake background job runner.
49 cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"
50
51 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
52
53 workflow_run_ok "${TEST_NAME_BASE}-run" \
54 cylc play --debug --no-detach "${WORKFLOW_NAME}"
55
56 # Run a bunch of tests on the workflow logs to ensure that warning messages
57 # produced by Intelligent Host Selection Logic have happened.
58
59 named_grep_ok "unreachable host warning" \
60 'Could not connect to unreachable_host' \
61 "${WORKFLOW_RUN_DIR}/log/scheduler/log"
62
63 # Ensure that retrying in this context doesn't increment try number:
64 grep_fail "1/mixedhosttask/02" "${WORKFLOW_RUN_DIR}/log/scheduler/log"
65
66 purge
67 exit 0