Skip to content

Commit 98d6b92

Browse files
authored
Merge pull request #73 from MetRonnie/platform-subshell-2
Tidy test
2 parents 005c5c0 + 2f5e9cb commit 98d6b92

File tree

2 files changed

+12
-35
lines changed

2 files changed

+12
-35
lines changed

tests/functional/platforms/12-ping-pong.t

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,23 @@
1919
# If a task has a platform set using a subshell this should be evaluated
2020
# every time the task is run.
2121
# https://github.com/cylc/cylc-flow/issues/6808
22-
export REQUIRE_PLATFORM='loc:remote fs:indep'
22+
export REQUIRE_PLATFORM='loc:remote'
2323

2424
. "$(dirname "$0")/test_header"
2525

2626
set_test_number 3
2727

28-
create_test_global_config "" "
29-
[platforms]
30-
[[${CYLC_TEST_HOST}]]
31-
hosts = ${CYLC_TEST_HOST}
32-
install target = ${CYLC_TEST_HOST}
33-
"
34-
3528
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
3629

37-
cat > var_file <<__HERE__
38-
REMOTE_HOST="${CYLC_TEST_HOST}"
39-
__HERE__
40-
4130
workflow_run_ok "${TEST_NAME_BASE}-run" \
42-
cylc play "${WORKFLOW_NAME}" --debug --no-detach --set-file var_file
31+
cylc play "${WORKFLOW_NAME}" --debug --no-detach
4332

44-
named_grep_ok "1/remote_task submits to ${CYLC_TEST_HOST}" \
45-
"\[1/remote_task/01:preparing\] submitted to ${CYLC_TEST_HOST}" \
33+
named_grep_ok "1/remote_task submits to ${CYLC_TEST_PLATFORM}" \
34+
"\[1/remote_task/01:preparing\] submitted to ${CYLC_TEST_PLATFORM}" \
4635
"${WORKFLOW_RUN_DIR}/log/scheduler/log"
4736

4837
named_grep_ok "2/remote_task submits to localhost" \
4938
"\[2/remote_task/01:preparing\] submitted to localhost" \
5039
"${WORKFLOW_RUN_DIR}/log/scheduler/log"
5140

41+
purge

tests/functional/platforms/12-ping-pong/flow.cylc

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,16 @@
1616
[[toggler]]
1717
script = """
1818
# Toggle the platform between localhost and the remote host
19-
# using the content of a file, ${TEST_DIR}/pretend-hall-info.
19+
# using the content of a file, ${CYLC_WORKFLOW_RUN_DIR}/pretend-hall-info.
2020
# between localhost and the remote.
2121
22-
A="localhost"
23-
B="${REMOTE_HOST}"
24-
25-
# Create pretend-hall-info file if it does not exist
26-
if [[ ! -f ${TEST_DIR}/pretend-hall-info ]]; then
27-
echo "localhost" > ${TEST_DIR}/pretend-hall-info
28-
fi
29-
30-
# Read the current platform from the file and toggle it
31-
this=$(cat ${TEST_DIR}/pretend-hall-info)
32-
echo ${TEST_DIR} $this
33-
echo "content of pretent-hall-info: $(cat ${TEST_DIR}/pretend-hall-info)"
34-
if [[ $this == "localhost" ]]; then
35-
echo ${REMOTE_HOST} > ${TEST_DIR}/pretend-hall-info
36-
cylc message -- "WARNING:changing platform to ${REMOTE_HOST}"
22+
if (( $CYLC_TASK_CYCLE_POINT % 2 == 1 )); then
23+
echo ${REMOTE_PLATFORM} > ${CYLC_WORKFLOW_RUN_DIR}/pretend-hall-info
24+
cylc message -- "changing platform to ${REMOTE_PLATFORM}"
3725
else
38-
echo "localhost" > ${TEST_DIR}/pretend-hall-info
39-
cylc message -- "WARNING:changing platform to localhost"
26+
echo "localhost" > ${CYLC_WORKFLOW_RUN_DIR}/pretend-hall-info
27+
cylc message -- "changing platform to localhost"
4028
fi
4129
"""
4230
[[[environment]]]
43-
REMOTE_HOST = {{ CYLC_TEST_HOST }}
44-
TEST_DIR = ${CYLC_WORKFLOW_RUN_DIR}
31+
REMOTE_PLATFORM = {{ CYLC_TEST_PLATFORM }}

0 commit comments

Comments
 (0)