| 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 Cylc Can select a host from a platform group |
| 19 |
# Failing if there is no good host _any_ platform |
| 20 |
# Succeeding if there is no bad host on any platform in the group |
| 21 |
export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp' |
| 22 |
|
| 23 |
. "$(dirname "$0")/test_header" |
| 24 |
|
| 25 |
#------------------------------------------------------------------------------- |
| 26 |
set_test_number 11 |
| 27 |
|
| 28 |
# Uses a fake background job runner to get around the single host restriction. |
| 29 |
|
| 30 |
create_test_global_config "" " |
| 31 |
[platforms] |
| 32 |
[[${CYLC_TEST_PLATFORM}]] |
| 33 |
# mixed host platform |
| 34 |
job runner = my_background |
| 35 |
hosts = unreachable_host, ${CYLC_TEST_HOST} |
| 36 |
[[[selection]]] |
| 37 |
method = 'definition order' |
| 38 |
[[badhostplatform]] |
| 39 |
job runner = my_background |
| 40 |
hosts = bad_host1, bad_host2 |
| 41 |
[[[selection]]] |
| 42 |
method = 'definition order' |
| 43 |
|
| 44 |
[platform groups] |
| 45 |
[[mixedplatformgroup]] |
| 46 |
platforms = badhostplatform, ${CYLC_TEST_PLATFORM} |
| 47 |
[[[selection]]] |
| 48 |
method = definition order |
| 49 |
[[goodplatformgroup]] |
| 50 |
platforms = ${CYLC_TEST_PLATFORM} |
| 51 |
[[[selection]]] |
| 52 |
method = definition order |
| 53 |
" |
| 54 |
#------------------------------------------------------------------------------- |
| 55 |
# Uncomment to print config for manual testing of workflow. |
| 56 |
# cylc config -i '[platforms]' >&2 |
| 57 |
# cylc config -i '[platform groups]' >&2 |
| 58 |
|
| 59 |
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" |
| 60 |
|
| 61 |
# Install the fake background job runner. |
| 62 |
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}" |
| 63 |
|
| 64 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 65 |
|
| 66 |
workflow_run_ok "${TEST_NAME_BASE}-run" \ |
| 67 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" --reference-test |
| 68 |
|
| 69 |
# should try remote-init on bad_host{1,2} then fail |
| 70 |
log_scan \ |
| 71 |
"${TEST_NAME_BASE}-badhostplatformgroup" \ |
| 72 |
"${WORKFLOW_RUN_DIR}/log/scheduler/log" 1 0 \ |
| 73 |
'platform: badhostplatform - remote init (on bad_host1)' \ |
| 74 |
'platform: badhostplatform - Could not connect to bad_host1.' \ |
| 75 |
'platform: badhostplatform - remote init (on bad_host2)' \ |
| 76 |
'platform: badhostplatform - Could not connect to bad_host2.' \ |
| 77 |
|
| 78 |
# should try remote-init on unreachable_host, then $CYLC_TEST_HOST then pass |
| 79 |
log_scan \ |
| 80 |
"${TEST_NAME_BASE}-goodplatformgroup" \ |
| 81 |
"${WORKFLOW_RUN_DIR}/log/scheduler/log" 1 0 \ |
| 82 |
"platform: ${CYLC_TEST_PLATFORM} - remote init (on unreachable_host)" \ |
| 83 |
"platform: ${CYLC_TEST_PLATFORM} - Could not connect to unreachable_host." \ |
| 84 |
"platform: ${CYLC_TEST_PLATFORM} - remote init (on ${CYLC_TEST_HOST})" \ |
| 85 |
"platform: ${CYLC_TEST_PLATFORM} - remote file install (on ${CYLC_TEST_HOST})" \ |
| 86 |
"\[1/ugly/01:preparing\] => submitted" |
| 87 |
|
| 88 |
purge |
| 89 |
exit 0 |