| 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 initialisation still fails where a task has a platform |
| 19 |
# with only unreachable hosts. |
| 20 |
# n.b. Hosts picked for unlikelyhood of names matching any real host. |
| 21 |
export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp' |
| 22 |
|
| 23 |
. "$(dirname "$0")/test_header" |
| 24 |
|
| 25 |
#------------------------------------------------------------------------------- |
| 26 |
set_test_number 7 |
| 27 |
|
| 28 |
# Uses a fake background job runner to get around the single host restriction. |
| 29 |
|
| 30 |
create_test_global_config "" " |
| 31 |
[platforms] |
| 32 |
[[badhostplatform]] |
| 33 |
job runner = my_background |
| 34 |
hosts = e9755ca30f5, 3c0b4799402 |
| 35 |
install target = ${CYLC_TEST_INSTALL_TARGET} |
| 36 |
retrieve job logs = True |
| 37 |
[[[selection]]] |
| 38 |
method = definition order |
| 39 |
|
| 40 |
[[goodhostplatform]] |
| 41 |
hosts = ${CYLC_TEST_HOST} |
| 42 |
install target = ${CYLC_TEST_INSTALL_TARGET} |
| 43 |
retrieve job logs = True |
| 44 |
|
| 45 |
[[mixedhostplatform]] |
| 46 |
job runner = my_background |
| 47 |
hosts = unreachable_host, ${CYLC_TEST_HOST} |
| 48 |
install target = ${CYLC_TEST_INSTALL_TARGET} |
| 49 |
retrieve job logs = True |
| 50 |
[[[selection]]] |
| 51 |
method = 'definition order' |
| 52 |
" |
| 53 |
#------------------------------------------------------------------------------- |
| 54 |
# Uncomment to print config for manual testing of workflow. |
| 55 |
# cylc config -i '[platforms]' >&2 |
| 56 |
|
| 57 |
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" |
| 58 |
|
| 59 |
# Install the fake background job runner. |
| 60 |
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}" |
| 61 |
|
| 62 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 63 |
|
| 64 |
workflow_run_ok "${TEST_NAME_BASE}-run" \ |
| 65 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 66 |
|
| 67 |
workflow_log="${WORKFLOW_RUN_DIR}/log/scheduler/log" |
| 68 |
|
| 69 |
# Check that badhosttask has submit failed, but not good or mixed |
| 70 |
named_grep_ok "badhost task submit failed" \ |
| 71 |
"1/badhosttask.* submit-failed" "${workflow_log}" |
| 72 |
named_grep_ok "goodhost suceeded" \ |
| 73 |
"1/mixedhosttask.* succeeded" "${workflow_log}" |
| 74 |
named_grep_ok "mixedhost task suceeded" \ |
| 75 |
"1/goodhosttask.* succeeded" "${workflow_log}" |
| 76 |
|
| 77 |
# Check for remote-init fail reason given in scheduler and job activity logs |
| 78 |
job_activity_log="${WORKFLOW_RUN_DIR}/log/job/1/badhosttask/01/job-activity.log" |
| 79 |
msg="initialisation did not complete (no hosts were reachable)" |
| 80 |
named_grep_ok "${msg:0:30}... (workflow log)" "$msg" "$workflow_log" |
| 81 |
named_grep_ok "${msg:0:30}... (job activity log)" "$msg" "$job_activity_log" |
| 82 |
|
| 83 |
purge |