Skip to content

Commit

Permalink
DevOps: Fix the daemon_client fixture (#5988)
Browse files Browse the repository at this point in the history
The logic of the `DaemonClient` was changed in `aiida-core==2.3` such
that the timeout of the `stop_daemon` call is different from what is
used by the `is_daemon_running` property. This can lead to the stop call
going through just fine but `is_daemon_running` still returning `True`
straight after. This usually resolves after a while but this false
positive can cause the tests to fail when the session is closing. The
`stopped_daemon_client` was already fixed by adding a manual grace
period for `is_daemon_running` to start returning `False`. Here the
same fix is added for `daemon_client`.
  • Loading branch information
sphuber authored May 2, 2023
1 parent 2c82881 commit 9e5f5ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aiida/manage/tests/pytest_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,13 @@ def daemon_client(aiida_profile):
daemon_client.stop_daemon(wait=True)
except DaemonNotRunningException:
pass
assert not daemon_client.is_daemon_running
# Give an additional grace period by manually waiting for the daemon to be stopped. In certain unit test
# scenarios, the built in wait time in ``daemon_client.stop_daemon`` is not sufficient and even though the
# daemon is stopped, ``daemon_client.is_daemon_running`` will return false for a little bit longer.
daemon_client._await_condition( # pylint: disable=protected-access
lambda: not daemon_client.is_daemon_running,
DaemonTimeoutException('The daemon failed to stop.'),
)


@pytest.fixture()
Expand Down

0 comments on commit 9e5f5ee

Please sign in to comment.