Debian Codegraph @

tests/k/restart/39-auto-restart-no-suitable-host.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 . "$(dirname "$0")/test_header"
19 set_test_number 3
20
21 BASE_GLOBAL_CONFIG="
22 [scheduler]
23 [[main loop]]
24 plugins = health check, auto restart
25 [[[auto restart]]]
26 interval = PT5S
27 [[events]]
28 abort on inactivity timeout = True
29 abort on stall timeout = True
30 inactivity timeout = PT2M
31 stall timeout = PT2M
32 "
33 #-------------------------------------------------------------------------------
34 # test that workflows will not attempt to auto stop-restart if there is no
35 # available host to restart on
36 init_workflow "${TEST_NAME_BASE}" <<< '
37 [scheduler]
38 UTC mode = True
39 allow implicit tasks = True
40 [scheduling]
41 initial cycle point = 2000
42 [[graph]]
43 P1D = foo
44 '
45
46 create_test_global_config '' "
47 ${BASE_GLOBAL_CONFIG}
48 [scheduler]
49 [[run hosts]]
50 available = localhost
51 "
52
53 cylc play "${WORKFLOW_NAME}" --debug
54 poll_workflow_running
55
56 create_test_global_config '' "
57 ${BASE_GLOBAL_CONFIG}
58 [scheduler]
59 [[run hosts]]
60 available = localhost
61 condemned = $(localhost_fqdn)
62 "
63
64 FILE=$(cylc cat-log "${WORKFLOW_NAME}" -m p |xargs readlink -f)
65 log_scan "${TEST_NAME_BASE}-no-auto-restart" "${FILE}" 20 1 \
66 'The Cylc workflow host will soon become un-available' \
67 'Workflow cannot automatically restart: No alternative host' \
68 'Workflow cannot automatically restart: No alternative host' \
69
70 cylc stop --kill --max-polls=10 --interval=2 "${WORKFLOW_NAME}"
71 purge
72 exit