Skip to content

Commit 00cad88

Browse files
committed
Fix tests
1 parent 57e5931 commit 00cad88

File tree

3 files changed

+21
-26
lines changed

3 files changed

+21
-26
lines changed

tests/functional/platforms/04-host-to-platform-upgrade-fail-inherit.t

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Child function not valid after inheritance.
2020
# Check for task failure at job-submit.
2121
. "$(dirname "$0")/test_header"
22-
set_test_number 3
22+
set_test_number 2
2323

2424
create_test_global_config '' "
2525
# non-existent platform
@@ -29,16 +29,11 @@ create_test_global_config '' "
2929

3030
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
3131

32-
# Both of these cases should validate ok.
33-
run_ok "${TEST_NAME_BASE}-validate" \
34-
cylc validate "${WORKFLOW_NAME}"
35-
3632
# Run the workflow
3733
workflow_run_fail "${TEST_NAME_BASE}-run" \
38-
cylc play --debug --no-detach "${WORKFLOW_NAME}"
34+
cylc play --no-detach "${WORKFLOW_NAME}"
3935

40-
# Grep for inherit-fail to fail later at submit time
41-
grep_ok "WorkflowConfigError:.*1/non-valid-child" \
36+
grep_ok "Task 'non-valid-child' has the following deprecated '\[runtime\]' setting(s)" \
4237
"${TEST_NAME_BASE}-run.stderr"
4338

4439
purge

tests/functional/platforms/14-trigger-paused-subshell.t

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
3030

3131
local_host_name=$(hostname)
3232
remote_host_name=$(cylc config -i "[platforms][${CYLC_TEST_PLATFORM}]hosts")
33+
remote_host_name=$(ssh -oStrictHostKeyChecking=no "$remote_host_name" hostname)
3334
workflow_log="${WORKFLOW_RUN_DIR}/log/scheduler/log"
35+
LOG_SCAN_GREP_OPTS="-E"
3436

3537
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
3638
cylc play "${WORKFLOW_NAME}" --pause
@@ -40,21 +42,21 @@ cylc trigger "${WORKFLOW_NAME}//1/foo"
4042

4143
log_scan "log-grep-01" "$workflow_log" 10 2 \
4244
"\[1/foo/01:preparing\] submitted to localhost" \
43-
"\[1/foo/01:.*\] (received)${local_host_name}" \
45+
"\[1/foo/01:.*\] \(received\)${local_host_name}" \
4446
"\[1/foo/01:.*\] => succeeded"
4547

4648
cylc trigger "${WORKFLOW_NAME}//1/foo"
4749

4850
log_scan "log-grep-02" "$workflow_log" 10 2 \
4951
"\[1/foo/02:preparing\] submitted to ${CYLC_TEST_PLATFORM}" \
50-
"\[1/foo/02:.*\] (received)${remote_host_name}" \
52+
"\[1/foo/02:.*\] \((received|polled)\)${remote_host_name}" \
5153
"\[1/foo/02:.*\] => succeeded"
5254

5355
cylc trigger "${WORKFLOW_NAME}//1/foo"
5456

5557
log_scan "log-grep-03" "$workflow_log" 10 2 \
5658
"\[1/foo/03:preparing\] submitted to localhost" \
57-
"\[1/foo/03:.*\] (received)${local_host_name}" \
59+
"\[1/foo/03:.*\] \(received\)${local_host_name}" \
5860
"\[1/foo/03:.*\] => succeeded"
5961

6062
cylc stop "${WORKFLOW_NAME}" --now --now

tests/integration/test_reload.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ async def test_reload_waits_for_pending_tasks(
3636
scheduler,
3737
start,
3838
monkeypatch,
39-
capture_submission,
4039
log_scan,
4140
):
4241
"""Reload should flush out preparing tasks and pause the workflow.
@@ -47,9 +46,11 @@ async def test_reload_waits_for_pending_tasks(
4746
4847
See https://github.com/cylc/cylc-flow/issues/5107
4948
"""
49+
# speed up the test:
50+
monkeypatch.setattr('cylc.flow.scheduler.sleep', lambda *_: None)
5051
# a simple workflow with a single task
5152
id_ = flow('foo')
52-
schd = scheduler(id_, paused_start=False)
53+
schd: Scheduler = scheduler(id_, paused_start=False)
5354

5455
# we will artificially push the task through these states
5556
state_seq = [
@@ -63,26 +64,24 @@ async def test_reload_waits_for_pending_tasks(
6364

6465
# start the scheduler
6566
async with start(schd) as log:
66-
# disable submission events to prevent anything from actually running
67-
capture_submission(schd)
67+
foo = schd.pool.get_tasks()[0]
6868

6969
# set the task to go through some state changes
70-
def change_state(_=0):
70+
def submit_task_jobs(*a, **k):
7171
with suppress(IndexError):
7272
foo.state_reset(state_seq.pop(0))
73+
return [foo]
74+
7375
monkeypatch.setattr(
74-
'cylc.flow.scheduler.sleep',
75-
change_state
76+
schd.task_job_mgr, 'submit_task_jobs', submit_task_jobs
7677
)
7778

7879
# the task should start as waiting
79-
tasks = schd.pool.get_tasks()
80-
assert len(tasks) == 1
81-
foo = tasks[0]
82-
assert tasks[0].state(TASK_STATUS_WAITING)
80+
assert foo.state(TASK_STATUS_WAITING)
8381

8482
# put the task into the preparing state
85-
change_state()
83+
schd.release_tasks_to_run()
84+
assert foo.state(TASK_STATUS_PREPARING)
8685

8786
# reload the workflow
8887
await commands.run_cmd(commands.reload_workflow(schd))
@@ -96,12 +95,11 @@ def change_state(_=0):
9695
[
9796
# the task should have entered the preparing state before the
9897
# reload was requested
99-
'[1/foo:waiting(queued)] => preparing(queued)',
98+
'[1/foo:waiting] => preparing',
10099
# the reload should have put the workflow into the paused state
101100
'Pausing the workflow: Reloading workflow',
102101
# reload should have waited for the task to submit
103-
'[1/foo/00:preparing(queued)]'
104-
' => submitted(queued)',
102+
'[1/foo/00:preparing] => submitted',
105103
# before then reloading the workflow config
106104
'Reloading the workflow definition.',
107105
# post-reload the workflow should have been resumed

0 commit comments

Comments
 (0)