| 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 restarting a simple workflow with a failed task |
| 19 |
if [[ -z ${TEST_DIR:-} ]]; then |
| 20 |
. "$(dirname "$0")/test_header" |
| 21 |
fi |
| 22 |
#------------------------------------------------------------------------------- |
| 23 |
set_test_number 7 |
| 24 |
#------------------------------------------------------------------------------- |
| 25 |
install_workflow "${TEST_NAME_BASE}" 'failed' |
| 26 |
cp "$TEST_SOURCE_DIR/lib/flow-runtime-restart.cylc" "${RUN_DIR}/${WORKFLOW_NAME}/" |
| 27 |
#------------------------------------------------------------------------------- |
| 28 |
TEST_NAME="${TEST_NAME_BASE}-validate" |
| 29 |
run_ok "${TEST_NAME}" cylc validate "${WORKFLOW_NAME}" |
| 30 |
cmp_ok "${TEST_NAME}.stderr" <'/dev/null' |
| 31 |
#------------------------------------------------------------------------------- |
| 32 |
TEST_NAME="${TEST_NAME_BASE}-run" |
| 33 |
workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 34 |
#------------------------------------------------------------------------------- |
| 35 |
TEST_NAME="${TEST_NAME_BASE}-restart-run" |
| 36 |
workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 37 |
#------------------------------------------------------------------------------- |
| 38 |
grep_ok "failed_task|20130923T0000Z|1|1|failed" \ |
| 39 |
"${RUN_DIR}/${WORKFLOW_NAME}/pre-restart-db" |
| 40 |
contains_ok "${RUN_DIR}/${WORKFLOW_NAME}/post-restart-db" <<'__DB_DUMP__' |
| 41 |
failed_task|20130923T0000Z|1|1|failed |
| 42 |
shutdown|20130923T0000Z|1|1|succeeded |
| 43 |
__DB_DUMP__ |
| 44 |
"${TEST_SOURCE_DIR}/bin/ctb-select-task-states" "${WORKFLOW_RUN_DIR}" \ |
| 45 |
> "${RUN_DIR}/${WORKFLOW_NAME}/db" |
| 46 |
contains_ok "${RUN_DIR}/${WORKFLOW_NAME}/db" <<'__DB_DUMP__' |
| 47 |
failed_task|20130923T0000Z|1|1|failed |
| 48 |
finish|20130923T0000Z|1|1|succeeded |
| 49 |
output_states|20130923T0000Z|1|1|succeeded |
| 50 |
shutdown|20130923T0000Z|1|1|succeeded |
| 51 |
__DB_DUMP__ |
| 52 |
#------------------------------------------------------------------------------- |
| 53 |
purge |