Skip to content

Commit e948bcf

Browse files
committed
same in state tests
1 parent 7d5adf3 commit e948bcf

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

tests/test_03_state.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
def test_stop_with_queued_jobs(datadir, start_tomato_daemon, stop_tomato_daemon):
1919
os.chdir(datadir)
20-
ketchup.submit(payload="counter_1_0.1.yml", jobname="job-1", **kwargs)
21-
ketchup.submit(payload="counter_5_0.2.yml", jobname="job-2", **kwargs)
20+
ret = tomato.status(**kwargs)
21+
assert ret.success
22+
daemon = ret.data
23+
24+
ketchup.submit(payload="counter_1_0.1.yml", jobname="job-1", **kwargs, daemon=daemon)
25+
ketchup.submit(payload="counter_5_0.2.yml", jobname="job-2", **kwargs, daemon=daemon)
2226

2327
time.sleep(1)
2428
tomato.stop(**kwargs)
@@ -35,7 +39,11 @@ def test_stop_with_queued_jobs(datadir, start_tomato_daemon, stop_tomato_daemon)
3539

3640
def test_stop_with_running_jobs(datadir, start_tomato_daemon, stop_tomato_daemon):
3741
os.chdir(datadir)
38-
ketchup.submit(payload="counter_5_0.2.yml", jobname="job-1", **kwargs)
42+
ret = tomato.status(**kwargs)
43+
assert ret.success
44+
daemon = ret.data
45+
46+
ketchup.submit(payload="counter_5_0.2.yml", jobname="job-1", **kwargs, daemon=daemon)
3947
tomato.pipeline_load(**kwargs, pipeline="pip-counter", sampleid="counter_5_0.2")
4048
tomato.pipeline_ready(**kwargs, pipeline="pip-counter")
4149
assert utils.wait_until_ketchup_status(1, "r", PORT, WAIT)
@@ -48,7 +56,11 @@ def test_stop_with_running_jobs(datadir, start_tomato_daemon, stop_tomato_daemon
4856

4957
def test_restart_with_running_jobs(datadir, start_tomato_daemon, stop_tomato_daemon):
5058
os.chdir(datadir)
51-
ketchup.submit(payload="counter_20_5.yml", jobname="job-1", **kwargs)
59+
ret = tomato.status(**kwargs)
60+
assert ret.success
61+
daemon = ret.data
62+
63+
ketchup.submit(payload="counter_20_5.yml", jobname="job-1", **kwargs, daemon=daemon)
5264
tomato.pipeline_load(**kwargs, pipeline="pip-counter", sampleid="counter_20_5")
5365
tomato.pipeline_ready(**kwargs, pipeline="pip-counter")
5466
assert utils.wait_until_ketchup_status(1, "r", PORT, WAIT)
@@ -76,7 +88,11 @@ def test_restart_with_running_jobs(datadir, start_tomato_daemon, stop_tomato_dae
7688

7789
def test_restart_with_complete_jobs(datadir, start_tomato_daemon, stop_tomato_daemon):
7890
os.chdir(datadir)
79-
ketchup.submit(payload="counter_5_0.2.yml", jobname="job-1", **kwargs)
91+
ret = tomato.status(**kwargs)
92+
assert ret.success
93+
daemon = ret.data
94+
95+
ketchup.submit(payload="counter_5_0.2.yml", jobname="job-1", **kwargs, daemon=daemon)
8096
tomato.pipeline_load(**kwargs, pipeline="pip-counter", sampleid="counter_5_0.2")
8197
tomato.pipeline_ready(**kwargs, pipeline="pip-counter")
8298
assert utils.wait_until_ketchup_status(1, "r", PORT, timeout=WAIT)
@@ -98,7 +114,11 @@ def test_restart_with_complete_jobs(datadir, start_tomato_daemon, stop_tomato_da
98114

99115
def test_restart_with_crashed_jobs(datadir, start_tomato_daemon, stop_tomato_daemon):
100116
os.chdir(datadir)
101-
ketchup.submit(payload="counter_20_5.yml", jobname="job-1", **kwargs)
117+
ret = tomato.status(**kwargs)
118+
assert ret.success
119+
daemon = ret.data
120+
121+
ketchup.submit(payload="counter_20_5.yml", jobname="job-1", **kwargs, daemon=daemon)
102122
tomato.pipeline_load(**kwargs, pipeline="pip-counter", sampleid="counter_20_5")
103123
tomato.pipeline_ready(**kwargs, pipeline="pip-counter")
104124
assert utils.wait_until_ketchup_status(1, "r", PORT, WAIT)
@@ -146,7 +166,11 @@ def test_crashed_driver_restarts(datadir, start_tomato_daemon, stop_tomato_daemo
146166

147167
def test_crashed_driver_with_jobs(datadir, start_tomato_daemon, stop_tomato_daemon):
148168
os.chdir(datadir)
149-
ketchup.submit(payload="counter_5_0.2.yml", jobname="job-1", **kwargs)
169+
ret = tomato.status(**kwargs)
170+
assert ret.success
171+
daemon = ret.data
172+
173+
ketchup.submit(payload="counter_5_0.2.yml", jobname="job-1", **kwargs, daemon=daemon)
150174
tomato.pipeline_load(**kwargs, pipeline="pip-counter", sampleid="counter_5_0.2")
151175
tomato.pipeline_ready(**kwargs, pipeline="pip-counter")
152176
assert utils.wait_until_ketchup_status(1, "r", PORT, WAIT)

0 commit comments

Comments
 (0)