Skip to content

Commit

Permalink
Fix failing stop test.
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKraus committed Jul 21, 2024
1 parent b4897b1 commit 90f8065
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/tomato/tomato/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,13 @@ def stop(
req.connect(f"tcp://127.0.0.1:{port}")
req.send_pyobj(dict(cmd="stop"))
rep = req.recv_pyobj()
if rep.msg == "stop":
logger.debug(f"{rep=}")
if rep.data == "stop":
return Reply(
success=True,
msg=f"tomato-daemon on port {port} was instructed to stop",
)
elif rep.msg == "running":
elif rep.data == "running":
return Reply(
success=False,
msg=f"tomato-daemon on port {port} cannot stop as jobs are running",
Expand All @@ -263,7 +264,7 @@ def stop(
else:
return Reply(
success=False,
msg=f"unknown error: {rep.msg}",
msg=f"unknown error: {rep}",
data=rep.data,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_01_tomato.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_tomato_stop(start_tomato_daemon, stop_tomato_daemon):
assert wait_until_tomato_running(port=PORT, timeout=5000)
ret = tomato.stop(**kwargs)
assert ret.success
wait_until_tomato_stopped(port=PORT, timeout=5000)
assert wait_until_tomato_stopped(port=PORT, timeout=5000)

assert Path("daemon_12345.log").exists()
with Path("daemon_12345.log").open() as logf:
Expand Down

0 comments on commit 90f8065

Please sign in to comment.