| 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 workflow shuts down with error on missing run directory |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
set_test_number 3 |
| 21 |
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" |
| 22 |
|
| 23 |
create_test_global_config "" " |
| 24 |
[scheduler] |
| 25 |
[[main loop]] |
| 26 |
[[[health check]]] |
| 27 |
interval = PT10S" |
| 28 |
OPT_SET='-s GLOBALCFG=True' |
| 29 |
|
| 30 |
# shellcheck disable=SC2086 |
| 31 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate ${OPT_SET} "${WORKFLOW_NAME}" |
| 32 |
# Workflow run directory is now a symbolic link, so we can easily delete it. |
| 33 |
SYM_WORKFLOW_RUND="${WORKFLOW_RUN_DIR}-sym" |
| 34 |
SYM_WORKFLOW_NAME="${WORKFLOW_NAME}-sym" |
| 35 |
ln -s "$(basename "${WORKFLOW_NAME}")" "${SYM_WORKFLOW_RUND}" |
| 36 |
# shellcheck disable=SC2086 |
| 37 |
workflow_run_fail "${TEST_NAME_BASE}-run" \ |
| 38 |
cylc play --no-detach --abort-if-any-task-fails ${OPT_SET} "${SYM_WORKFLOW_NAME}" |
| 39 |
# Possible failure modes: |
| 40 |
# - health check detects missing run directory |
| 41 |
# - DB housekeeping cannot access DB because run directory missing |
| 42 |
# - (TODO: if other failure modes show up, add to the list here!) |
| 43 |
FAIL1="Workflow run directory does not exist: ${SYM_WORKFLOW_RUND}" |
| 44 |
FAIL2="sqlite3.OperationalError: unable to open database file" |
| 45 |
grep_ok "(${FAIL1}|${FAIL2})" "${WORKFLOW_RUN_DIR}/log/scheduler/"*.log -E |
| 46 |
rm -f "${SYM_WORKFLOW_RUND}" |
| 47 |
purge |
| 48 |
exit |