Debian Codegraph @

tests/f/cylc-play/11-remote-reinvoke-uncontactable.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 that remote reinvocation exits non-zero if the remote host is
19 # uncontactable.
20 # https://github.com/cylc/cylc-flow/pull/6745
21 # Ideally we would test with multiple hosts in [scheduler][run hosts]available
22 # to ensure each is tried, but that is not feasible.
23
24 export REQUIRE_PLATFORM='loc:remote fs:shared'
25 # (We need a valid remote host; the platform itself is not used)
26
27 . "$(dirname "$0")/test_header"
28 set_test_number 2
29
30 # create an SSH config that will fail to connect to a valid host
31 mock_ssh_config_file="/var/tmp/cylc-test-ssh-config"
32 cat > "${mock_ssh_config_file}" << __EOF__
33 Host ${CYLC_TEST_HOST}*
34 User BorkedMushroom25
35 __EOF__
36
37 create_test_global_config "" "
38 [scheduler]
39 [[run hosts]]
40 available = ${CYLC_TEST_HOST}
41 ranking =
42 [platforms]
43 [[localhost]]
44 ssh command = ssh -oBatchMode=yes -oStrictHostKeyChecking=no -F ${mock_ssh_config_file}
45 "
46
47 init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
48 [scheduler]
49 allow implicit tasks = True
50 [scheduling]
51 [[graph]]
52 R1 = a
53 __FLOW_CONFIG__
54
55 TEST_NAME="${TEST_NAME_BASE}-run"
56 workflow_run_fail "$TEST_NAME" \
57 cylc play "${WORKFLOW_NAME}" --no-detach --mode=simulation
58
59 grep_ok "Cylc could not establish SSH connection to the run hosts" \
60 "${TEST_NAME}.stderr"