| 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 remote init fails if symlink dir target already exists |
| 19 |
|
| 20 |
export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp' |
| 21 |
. "$(dirname "$0")/test_header" |
| 22 |
set_test_number 5 |
| 23 |
|
| 24 |
SSH_CMD="$(cylc config -d -i "[platforms][${CYLC_TEST_PLATFORM}]ssh command")" |
| 25 |
|
| 26 |
create_test_global_config "" " |
| 27 |
[install] |
| 28 |
[[symlink dirs]] |
| 29 |
[[[${CYLC_TEST_INSTALL_TARGET}]]] |
| 30 |
run = \$TMPDIR/\$USER/sym-run |
| 31 |
" |
| 32 |
install_workflow "${TEST_NAME_BASE}" basic |
| 33 |
|
| 34 |
run_ok "${TEST_NAME_BASE}-val" cylc validate "$WORKFLOW_NAME" |
| 35 |
|
| 36 |
# Run once to setup symlink dirs on remote install target |
| 37 |
workflow_run_ok "${TEST_NAME_BASE}-run" cylc play --no-detach "$WORKFLOW_NAME" |
| 38 |
|
| 39 |
# Remove remote run dir symlink (but not its target) |
| 40 |
$SSH_CMD "$CYLC_TEST_HOST" "rm -rf ~/cylc-run/${WORKFLOW_NAME}" |
| 41 |
|
| 42 |
# New run should abort |
| 43 |
delete_db |
| 44 |
TEST_NAME="${TEST_NAME_BASE}-run-again" |
| 45 |
workflow_run_fail "$TEST_NAME" cylc play --no-detach "$WORKFLOW_NAME" |
| 46 |
|
| 47 |
grep_ok "ERROR - platform: .* initialisation did not complete" "${TEST_NAME}.stderr" |
| 48 |
grep_ok "WorkflowFilesError: Symlink dir target already exists" "${TEST_NAME}.stderr" |
| 49 |
|
| 50 |
# Clean up remote symlink dir target |
| 51 |
# shellcheck disable=SC2016 |
| 52 |
$SSH_CMD "$CYLC_TEST_HOST" 'rm -rf "${TMPDIR}/${USER}/sym-run"' |
| 53 |
|
| 54 |
purge |