| 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 validation fails on bad task event handler templates. |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
|
| 21 |
set_test_number 4 |
| 22 |
|
| 23 |
TEST_NAME="${TEST_NAME_BASE}-bad-key" |
| 24 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 25 |
[scheduling] |
| 26 |
[[graph]] |
| 27 |
R1=t1 |
| 28 |
[runtime] |
| 29 |
[[t1]] |
| 30 |
script=true |
| 31 |
[[[events]]] |
| 32 |
failed handlers = echo %(id)s, echo %(rubbish)s |
| 33 |
__FLOW_CONFIG__ |
| 34 |
run_fail "${TEST_NAME}" cylc validate . |
| 35 |
cmp_ok "${TEST_NAME}.stderr" <<'__ERR__' |
| 36 |
WorkflowConfigError: bad task event handler template t1: echo %(rubbish)s: KeyError('rubbish') |
| 37 |
__ERR__ |
| 38 |
|
| 39 |
TEST_NAME="${TEST_NAME_BASE}-bad-value" |
| 40 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 41 |
[scheduling] |
| 42 |
[[graph]] |
| 43 |
R1=t1 |
| 44 |
[runtime] |
| 45 |
[[t1]] |
| 46 |
script=true |
| 47 |
[[[events]]] |
| 48 |
failed handlers = echo %(ids |
| 49 |
__FLOW_CONFIG__ |
| 50 |
run_fail "${TEST_NAME}" cylc validate . |
| 51 |
cmp_ok "${TEST_NAME}.stderr" <<'__ERR__' |
| 52 |
WorkflowConfigError: bad task event handler template t1: echo %(ids: ValueError('incomplete format key') |
| 53 |
__ERR__ |
| 54 |
|
| 55 |
exit |