| 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 submit-failed task |
| 19 |
export REQUIRE_PLATFORM='runner:at' |
| 20 |
if [[ -z ${TEST_DIR:-} ]]; then |
| 21 |
. "$(dirname "$0")/test_header" |
| 22 |
fi |
| 23 |
#------------------------------------------------------------------------------- |
| 24 |
set_test_number 7 |
| 25 |
#------------------------------------------------------------------------------- |
| 26 |
create_test_global_config " |
| 27 |
[platforms] |
| 28 |
[[$CYLC_TEST_PLATFORM]] |
| 29 |
job runner = at |
| 30 |
job runner command template = at oh-no |
| 31 |
" |
| 32 |
#------------------------------------------------------------------------------- |
| 33 |
install_workflow "${TEST_NAME_BASE}" 'submit-failed' |
| 34 |
cp "$TEST_SOURCE_DIR/lib/flow-runtime-restart.cylc" "$RUN_DIR/${WORKFLOW_NAME}/" |
| 35 |
#------------------------------------------------------------------------------- |
| 36 |
TEST_NAME="${TEST_NAME_BASE}-validate" |
| 37 |
run_ok "${TEST_NAME}" cylc validate "${WORKFLOW_NAME}" |
| 38 |
cmp_ok "${TEST_NAME}.stderr" <'/dev/null' |
| 39 |
#------------------------------------------------------------------------------- |
| 40 |
TEST_NAME="${TEST_NAME_BASE}-run" |
| 41 |
workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 42 |
#------------------------------------------------------------------------------- |
| 43 |
TEST_NAME="${TEST_NAME_BASE}-restart" |
| 44 |
workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 45 |
#------------------------------------------------------------------------------- |
| 46 |
grep_ok "submit_failed_task|20130923T0000Z|1|1|submit-failed" \ |
| 47 |
"${WORKFLOW_RUN_DIR}/pre-restart-db" |
| 48 |
contains_ok "${WORKFLOW_RUN_DIR}/post-restart-db" <<'__DB_DUMP__' |
| 49 |
submit_failed_task|20130923T0000Z|1|1|submit-failed |
| 50 |
__DB_DUMP__ |
| 51 |
"${WORKFLOW_RUN_DIR}/bin/ctb-select-task-states" "${WORKFLOW_RUN_DIR}" \ |
| 52 |
> "${TEST_DIR}/db" |
| 53 |
contains_ok "${TEST_DIR}/db" <<'__DB_DUMP__' |
| 54 |
submit_failed_task|20130923T0000Z|1|1|submit-failed |
| 55 |
__DB_DUMP__ |
| 56 |
#------------------------------------------------------------------------------- |
| 57 |
purge |
| 58 |
exit |