| 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 for a bad recurrences |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
#------------------------------------------------------------------------------- |
| 21 |
set_test_number 10 |
| 22 |
|
| 23 |
TEST_NAME="${TEST_NAME_BASE}-interval" |
| 24 |
cat >'flow.cylc' <<'__WORKFLOW__' |
| 25 |
[scheduler] |
| 26 |
cycle point time zone = +01 |
| 27 |
[scheduling] |
| 28 |
initial cycle point = 20140101T00 |
| 29 |
final cycle point = 20140201T00 |
| 30 |
[[graph]] |
| 31 |
# PT5D is invalid - should be P5D |
| 32 |
R/T00/PT5D = "foo" |
| 33 |
[runtime] |
| 34 |
[[foo]] |
| 35 |
script = true |
| 36 |
__WORKFLOW__ |
| 37 |
run_fail "${TEST_NAME}" cylc validate . |
| 38 |
cmp_ok "${TEST_NAME}.stderr" <<'__ERR__' |
| 39 |
WorkflowConfigError: Cannot process recurrence R/T00/PT5D (initial cycle point=20140101T0000+01) (final cycle point=20140201T0000+01) |
| 40 |
__ERR__ |
| 41 |
|
| 42 |
TEST_NAME="${TEST_NAME_BASE}-old-icp" |
| 43 |
cat >'flow.cylc' <<'__WORKFLOW__' |
| 44 |
[scheduler] |
| 45 |
UTC mode = True |
| 46 |
[scheduling] |
| 47 |
initial cycle point = 20140101 |
| 48 |
[[graph]] |
| 49 |
R1/P0D = "foo => final_foo" |
| 50 |
[runtime] |
| 51 |
[[root]] |
| 52 |
script = true |
| 53 |
__WORKFLOW__ |
| 54 |
run_fail "${TEST_NAME}" cylc validate . |
| 55 |
cmp_ok "${TEST_NAME}.stderr" <<'__ERR__' |
| 56 |
WorkflowConfigError: Cannot process recurrence R1/P0D (initial cycle point=20140101T0000Z) (final cycle point=None) This workflow requires a final cycle point. |
| 57 |
__ERR__ |
| 58 |
|
| 59 |
TEST_NAME="${TEST_NAME_BASE}-2-digit-century" |
| 60 |
cat >'flow.cylc' <<'__WORKFLOW__' |
| 61 |
[scheduler] |
| 62 |
cycle point time zone = +01 |
| 63 |
[scheduling] |
| 64 |
initial cycle point = 20140101T00 |
| 65 |
final cycle point = 20140201T00 |
| 66 |
[[graph]] |
| 67 |
# Users may easily write 00 where they mean T00 or '0' in old syntax. |
| 68 |
# Technically 00 means the year 0000, but we won't allow it in Cylc. |
| 69 |
R/00/P5D = "foo" |
| 70 |
[runtime] |
| 71 |
[[foo]] |
| 72 |
script = true |
| 73 |
__WORKFLOW__ |
| 74 |
run_fail "${TEST_NAME}" cylc validate . |
| 75 |
cmp_ok "${TEST_NAME}.stderr" <<'__ERR__' |
| 76 |
WorkflowConfigError: Cannot process recurrence R/00/P5D (initial cycle point=20140101T0000+01) (final cycle point=20140201T0000+01) '00': 2 digit centuries not allowed. Did you mean T-digit-digit e.g. 'T00'? |
| 77 |
__ERR__ |
| 78 |
|
| 79 |
TEST_NAME="${TEST_NAME_BASE}-old-recurrences" |
| 80 |
cat >'flow.cylc' <<'__WORKFLOW__' |
| 81 |
[scheduler] |
| 82 |
cycle point time zone = +01 |
| 83 |
[scheduling] |
| 84 |
initial cycle point = 20100101T00 |
| 85 |
[[graph]] |
| 86 |
0,6,12 = "foo" |
| 87 |
__WORKFLOW__ |
| 88 |
run_fail "${TEST_NAME}" cylc validate . |
| 89 |
cmp_ok "${TEST_NAME}.stderr" <<'__ERR__' |
| 90 |
WorkflowConfigError: Cannot process recurrence 0 (initial cycle point=20100101T0000+01) (final cycle point=None) '0': not a valid cylc-shorthand or full ISO 8601 date representation |
| 91 |
__ERR__ |
| 92 |
|
| 93 |
TEST_NAME="${TEST_NAME_BASE}-old-cycle-point-format" |
| 94 |
cat >'flow.cylc' <<'__WORKFLOW__' |
| 95 |
[scheduler] |
| 96 |
cycle point format = %Y%m%d%H |
| 97 |
[scheduling] |
| 98 |
initial cycle point = 2010010101 |
| 99 |
[[graph]] |
| 100 |
R1 = foo |
| 101 |
__WORKFLOW__ |
| 102 |
run_fail "${TEST_NAME}" cylc validate . |
| 103 |
cmp_ok "${TEST_NAME}.stderr" <<'__ERR__' |
| 104 |
WorkflowConfigError: Cannot process recurrence R1 (initial cycle point=2010010101) (final cycle point=None) '2010010101': not a valid cylc-shorthand or full ISO 8601 date representation |
| 105 |
__ERR__ |
| 106 |
|
| 107 |
exit |