| 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 sending commands to a workflow on a host with shared file system with |
| 19 |
# current host. |
| 20 |
export REQUIRE_PLATFORM='loc:remote fs:shared' |
| 21 |
. "$(dirname "$0")/test_header" |
| 22 |
set_test_number 4 |
| 23 |
|
| 24 |
# "install_workflow" does not work here because it installs workflows on the TMPDIR, |
| 25 |
# which is often on local file systems. We need to ensure that the workflow |
| 26 |
# definition directory is on a shared file system. |
| 27 |
WORKFLOW_NAME="${CYLC_TEST_REG_BASE}/${TEST_SOURCE_DIR_BASE}/${TEST_NAME_BASE}" |
| 28 |
WORKFLOW_RUN_DIR="$RUN_DIR/${WORKFLOW_NAME}" |
| 29 |
mkdir -p "$(dirname "${WORKFLOW_RUN_DIR}")" |
| 30 |
cp -r "${TEST_SOURCE_DIR}/${TEST_NAME_BASE}" "${WORKFLOW_RUN_DIR}" |
| 31 |
cylc install --workflow-name="${WORKFLOW_NAME}" --no-run-name 2>'/dev/null' |
| 32 |
|
| 33 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 34 |
|
| 35 |
cylc play --debug --no-detach --reference-test \ |
| 36 |
--host="${CYLC_TEST_HOST}" "${WORKFLOW_NAME}" 1>'out' 2>&1 & |
| 37 |
WORKFLOW_PID="$!" |
| 38 |
|
| 39 |
# Poll for job to fail |
| 40 |
WORKFLOW_LOG="${WORKFLOW_RUN_DIR}/log/scheduler/log" |
| 41 |
# Note: double poll existence of workflow log on workflow host and then localhost to |
| 42 |
# avoid any issues with unstable mounting of the shared file system. |
| 43 |
poll ssh -oBatchMode=yes -n "${CYLC_TEST_HOST}" test -e "${WORKFLOW_LOG}" |
| 44 |
poll_grep_workflow_log -E '19700101T0000Z/t1/01:submitted.* => running' |
| 45 |
poll_grep_workflow_log -E '19700101T0000Z/t1/01:running.* => failed' |
| 46 |
|
| 47 |
run_ok "${TEST_NAME_BASE}-broadcast" \ |
| 48 |
cylc broadcast -n 't1' -s '[environment]CYLC_TEST_VAR_FOO=foo' "${WORKFLOW_NAME}" |
| 49 |
run_ok "${TEST_NAME_BASE}-trigger" \ |
| 50 |
cylc trigger "${WORKFLOW_NAME}//19700101T0000Z/t1" |
| 51 |
|
| 52 |
if wait "${WORKFLOW_PID}"; then |
| 53 |
ok "${TEST_NAME_BASE}-run" |
| 54 |
else |
| 55 |
fail "${TEST_NAME_BASE}-run" |
| 56 |
cat 'out' >&2 |
| 57 |
fi |
| 58 |
|
| 59 |
purge |
| 60 |
exit |