| 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 |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
#------------------------------------------------------------------------------- |
| 21 |
set_test_number 9 |
| 22 |
#------------------------------------------------------------------------------- |
| 23 |
cat >>'global.cylc' <<__HERE__ |
| 24 |
[platforms] |
| 25 |
[[foo]] |
| 26 |
__HERE__ |
| 27 |
|
| 28 |
OLD="$CYLC_CONF_PATH" |
| 29 |
export CYLC_CONF_PATH="${PWD}" |
| 30 |
|
| 31 |
# Control Run |
| 32 |
run_ok "${TEST_NAME_BASE}-ok" cylc config -i "[platforms][foo]" |
| 33 |
|
| 34 |
# If item not settable in config (platforms is mis-spelled): |
| 35 |
run_fail "${TEST_NAME_BASE}-not-in-config-spec" cylc config -i "[platfroms][foo]" |
| 36 |
cmp_ok "${TEST_NAME_BASE}-not-in-config-spec.stderr" << __HERE__ |
| 37 |
InvalidConfigError: "platfroms" is not a valid configuration for global.cylc. |
| 38 |
__HERE__ |
| 39 |
|
| 40 |
# If item settable in config but not set. |
| 41 |
run_fail "${TEST_NAME_BASE}-not-defined" cylc config -i "[scheduler]" |
| 42 |
cmp_ok "${TEST_NAME_BASE}-not-defined.stderr" << __HERE__ |
| 43 |
ItemNotFoundError: You have not set "scheduler" in this config. |
| 44 |
__HERE__ |
| 45 |
|
| 46 |
run_fail "${TEST_NAME_BASE}-not-defined-2" cylc config -i "[platforms][bar]" |
| 47 |
cmp_ok "${TEST_NAME_BASE}-not-defined-2.stderr" << __HERE__ |
| 48 |
ItemNotFoundError: You have not set "[platforms]bar" in this config. |
| 49 |
__HERE__ |
| 50 |
|
| 51 |
run_fail "${TEST_NAME_BASE}-not-defined-3" cylc config -i "[platforms][foo]hosts" |
| 52 |
cmp_ok "${TEST_NAME_BASE}-not-defined-3.stderr" << __HERE__ |
| 53 |
ItemNotFoundError: You have not set "[platforms][foo]hosts" in this config. |
| 54 |
__HERE__ |
| 55 |
|
| 56 |
rm global.cylc |
| 57 |
export CYLC_CONF_PATH="$OLD" |