Debian Codegraph @

tests/functional/cylc-config/09-platforms.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 cylc config --platform-names and --platforms
19 . "$(dirname "$0")/test_header"
20 #-------------------------------------------------------------------------------
21 set_test_number 7
22 #-------------------------------------------------------------------------------
23 cat > "global.cylc" <<__HEREDOC__
24 [platforms]
25 [[foo]]
26 job runner = slurm
27 hosts = of_melkor, of_valar
28 [[bar]]
29 job runner = slurm
30 hosts = of_orcs, of_gondor
31 [platform groups]
32 [[FOO]]
33 platforms = foo, bar
34 [task events]
35 # Just make sure this doesn't get included
36 __HEREDOC__
37
38 export CYLC_CONF_PATH="${PWD}"
39
40 TEST_NAME="${TEST_NAME_BASE}-names"
41 run_ok "${TEST_NAME}" cylc config --platform-names
42 cmp_ok "${TEST_NAME}.stdout" <<__HEREDOC__
43 localhost
44 foo
45 bar
46 FOO
47 __HEREDOC__
48
49 cmp_ok "${TEST_NAME}.stderr" <<__HEREDOC__
50
51 Configured names are regular expressions; any match is a valid platform.
52 They are searched from the bottom up, until the first match is found.
53
54 Platforms
55 ---------
56
57 Platform Groups
58 --------------
59 __HEREDOC__
60
61 TEST_NAME="${TEST_NAME_BASE}-s"
62 head -n 10 > just_platforms < global.cylc
63 run_ok "${TEST_NAME}" cylc config --platforms
64 cmp_ok "${TEST_NAME}.stdout" "just_platforms"
65
66 #-------------------------------------------------------------------------------
67 # test with no platforms or platform groups defined
68 rm "global.cylc"
69 touch "global.cylc"
70
71 TEST_NAME="${TEST_NAME_BASE}-names"
72 run_ok "${TEST_NAME}" cylc config --platform-names
73 cmp_ok "${TEST_NAME}.stdout" <<__HEREDOC__
74 localhost
75
76 __HEREDOC__
77
78 exit