Debian Codegraph @

tests/f/platforms/11-platform-gone-on-restart.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 # If a platform is deleted from global config and restart cannot find an
19 # approproiate match, don't keep going.
20 # 1. Run a workflow which stops leaving a job running on a platform.
21 # 2. Delete the platform from global.cylc
22 # 3. Attempt to restart.
23 # 4. Check that restart fails in the desired manner.
24 . "$(dirname "$0")/test_header"
25
26 set_test_number 3
27
28 create_test_global_config "" "
29 [platforms]
30 [[myplatform]]
31 hosts = localhost
32 install target = localhost
33 "
34
35 init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONF__'
36 [scheduling]
37 initial cycle point = 2934
38 [[graph]]
39 R1 = foo => bar
40
41 [runtime]
42 [[foo]]
43 script = """
44 cylc stop ${CYLC_WORKFLOW_ID} --now --now
45 """
46 platform = myplatform
47 [[bar]]
48 script = true # only runs on restart
49 __FLOW_CONF__
50
51 run_ok "${TEST_NAME_BASE}-play" \
52 cylc play "${WORKFLOW_NAME}" --no-detach
53
54 # Wait for workflow to stop, then wreck the global config:
55 create_test_global_config "" "
56 "
57
58 # Test that restart fails:
59 run_fail "${TEST_NAME_BASE}-restart" \
60 cylc play "${WORKFLOW_NAME}" --no-detach
61 named_grep_ok \
62 "${TEST_NAME_BASE}-cannot-restart" \
63 "platforms are not defined in the global.cylc" \
64 "${RUN_DIR}/${WORKFLOW_NAME}/log/scheduler/log"
65
66 purge