Skip to content

Commit fbb209a

Browse files
committed
🧪 Fix flaky daemon stop test (#7319)
Wait for the daemon PID file to disappear before asserting that `is_daemon_running` is false in `test_daemon_stop`. The CLI stop command can return before Circus removes the PID file, which makes an immediate assertion timing-sensitive in CI. This aligns the test with the existing daemon fixtures, which already apply the same extra wait to avoid this race. Reviewed-by: Julian Geiger <julian.geiger@psi.ch>
1 parent f391086 commit fbb209a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/cmdline/commands/test_daemon.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from aiida import get_profile
1717
from aiida.cmdline.commands import cmd_daemon
18-
from aiida.engine.daemon.client import DaemonClient
18+
from aiida.engine.daemon.client import DaemonClient, DaemonTimeoutException
1919

2020
pytestmark = pytest.mark.requires_rmq
2121

@@ -100,6 +100,11 @@ def test_daemon_stop(run_cli_command, started_daemon_client):
100100
"""Test ``verdi daemon stop``."""
101101
result = run_cli_command(cmd_daemon.stop)
102102

103+
started_daemon_client._await_condition(
104+
lambda: not started_daemon_client.is_daemon_running,
105+
DaemonTimeoutException('The daemon failed to stop.'),
106+
)
107+
103108
assert 'Stopping the daemon' in result.output
104109
assert not started_daemon_client.is_daemon_running
105110

0 commit comments

Comments
 (0)