Debian Codegraph @

tests/functional/cylc-get-site-config/04-homeless.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 # Check undefined $HOME does not break:
19 # a) use of $HOME in global config (GitHub #2895)
20 # b) global config Jinja2 support (GitHub #5155)
21
22 . "$(dirname "$0")/test_header"
23 set_test_number 5
24
25 # shellcheck disable=SC2016
26 create_test_global_config '' '
27 [install]
28 [[symlink dirs]]
29 [[[localhost]]]
30 run = $HOME/dr-malcolm
31 '
32 run_ok "${TEST_NAME_BASE}" \
33 env -u HOME \
34 cylc config --item='[install][symlink dirs][localhost]run'
35
36 cmp_ok "${TEST_NAME_BASE}.stdout" <<<"\$HOME/dr-malcolm"
37
38 # The test global config is created with #!Jinja2 at the top, in case of any
39 # Jinja2 code in global-tests.cylc. Parsec Jinja2 support uses $HOME to find
40 # custom filters etc. GitHub #5155.
41 for DIR in Filters Tests Globals; do
42 grep_ok "\$HOME undefined: can't load ~/.cylc/Jinja2$DIR" "${TEST_NAME_BASE}.stderr"
43 done