| 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 that removing the DB quickly after a shutdown does not cause it to be |
| 19 |
# regenerated due to any outstanding connection to the DB. |
| 20 |
# NOTE: this test is not guaranteed to catch the issue, but is more likely |
| 21 |
# to do so on slower filesystems. However, faster filesystems are |
| 22 |
# less likely to have the original issue in the first place. See |
| 23 |
# https://github.com/cylc/cylc-flow/pull/4046 |
| 24 |
|
| 25 |
. "$(dirname "$0")/test_header" |
| 26 |
|
| 27 |
set_test_number 5 |
| 28 |
|
| 29 |
init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__' |
| 30 |
[scheduler] |
| 31 |
allow implicit tasks = True |
| 32 |
[scheduling] |
| 33 |
[[dependencies]] |
| 34 |
R1 = foo |
| 35 |
__FLOW_CONFIG__ |
| 36 |
|
| 37 |
pri_db="${WORKFLOW_RUN_DIR}/.service/db" |
| 38 |
pub_db="${WORKFLOW_RUN_DIR}/log/db" |
| 39 |
|
| 40 |
TEST_NAME="${TEST_NAME_BASE}-run" |
| 41 |
workflow_run_ok "${TEST_NAME}" cylc play "${WORKFLOW_NAME}" |
| 42 |
|
| 43 |
poll_workflow_running |
| 44 |
poll_workflow_stopped # This waits for contact file to be removed |
| 45 |
# Delete the DB without delay |
| 46 |
rm -f "$pri_db" "$pub_db" |
| 47 |
# Check if DB exists without delay |
| 48 |
exists_fail "$pri_db" |
| 49 |
exists_fail "$pub_db" |
| 50 |
|
| 51 |
sleep 10 |
| 52 |
# Check if DB exists after delay |
| 53 |
exists_fail "$pri_db" |
| 54 |
exists_fail "$pub_db" |
| 55 |
|
| 56 |
purge |
| 57 |
exit |