| 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 start/restart/reload config logs are created correctly |
| 19 |
|
| 20 |
. "$(dirname "$0")/test_header" |
| 21 |
set_test_number 7 |
| 22 |
init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__' |
| 23 |
[scheduler] |
| 24 |
[[events]] |
| 25 |
abort on stall timeout = true |
| 26 |
stall timeout = PT0S |
| 27 |
abort on inactivity timeout = true |
| 28 |
inactivity timeout = PT1M |
| 29 |
[scheduling] |
| 30 |
[[graph]] |
| 31 |
R1 = reloader1 => stopper => reloader2 |
| 32 |
[runtime] |
| 33 |
[[reloader1, reloader2]] |
| 34 |
script = """ |
| 35 |
cylc reload "${CYLC_WORKFLOW_ID}" |
| 36 |
# wait for the command to complete |
| 37 |
cylc__job__poll_grep_workflow_log 'Reload completed' |
| 38 |
""" |
| 39 |
[[stopper]] |
| 40 |
script = cylc stop --now --now "${CYLC_WORKFLOW_ID}" |
| 41 |
__FLOW_CONFIG__ |
| 42 |
|
| 43 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 44 |
|
| 45 |
workflow_run_ok "${TEST_NAME_BASE}-run" cylc play --no-detach "${WORKFLOW_NAME}" |
| 46 |
|
| 47 |
# Check scheduler logs. |
| 48 |
ls "${WORKFLOW_RUN_DIR}/log/scheduler/" > schd_1.out |
| 49 |
cmp_ok schd_1.out << __EOF__ |
| 50 |
01-start-01.log |
| 51 |
log |
| 52 |
__EOF__ |
| 53 |
|
| 54 |
# Check config logs. |
| 55 |
ls "${WORKFLOW_RUN_DIR}/log/config/" > conf_1.out |
| 56 |
cmp_ok conf_1.out << __EOF__ |
| 57 |
01-start-01.cylc |
| 58 |
02-reload-01.cylc |
| 59 |
flow-processed.cylc |
| 60 |
__EOF__ |
| 61 |
|
| 62 |
mv "$WORKFLOW_RUN_DIR/cylc.flow.main_loop.log_db.sql" "$WORKFLOW_RUN_DIR/01.cylc.flow.main_loop.log_db.sql" |
| 63 |
|
| 64 |
workflow_run_ok "${TEST_NAME_BASE}-run" cylc play --no-detach "${WORKFLOW_NAME}" |
| 65 |
|
| 66 |
ls "${WORKFLOW_RUN_DIR}/log/scheduler/" > schd_2.out |
| 67 |
cmp_ok schd_2.out << __EOF__ |
| 68 |
01-start-01.log |
| 69 |
02-restart-02.log |
| 70 |
log |
| 71 |
__EOF__ |
| 72 |
|
| 73 |
ls "${WORKFLOW_RUN_DIR}/log/config/" > conf_2.out |
| 74 |
cmp_ok conf_2.out << __EOF__ |
| 75 |
01-start-01.cylc |
| 76 |
02-reload-01.cylc |
| 77 |
03-restart-02.cylc |
| 78 |
04-reload-02.cylc |
| 79 |
flow-processed.cylc |
| 80 |
__EOF__ |
| 81 |
|
| 82 |
purge |