-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimize D-Bus requirements for tests #5265
Conversation
This PR minimizes the D-Bus requirements for tests. It does this by using dbus-daemon directly instead of dbus-launch. The latter is meant for graphical applications and therefor has X11 dependencies. It also leaves the D-Bus daemon running after the tests are done. This will accumulate dbus-daemon processes over time which is not ideal. I've also considered using dbus-run-session since it is meant to launch processes with a private D-Bus session. For Python tests one could launch it like so: dbus-run-session -- python3 -m pytest ... Then `DBUS_SESSION_BUS_ADDRESS` would be used automatically by the `MessageBus` class. However, to keep the current behavior of the tests, launching the D-Bus daemon manually is the better option.
WalkthroughWalkthroughThe changes involve modifications to the GitHub Actions workflow and the test fixture setup for D-Bus sessions. The workflow file has updated its system dependency installation command from Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
We should follow this up with a change to devcontainer and switch what package it is installing here: https://github.com/home-assistant/devcontainer/blob/7ae0e50db3cadb3dca003175baa5288801e5874a/supervisor/Dockerfile#L15 But tested in current devcontainer and still works fine because |
Addressed with: home-assistant/devcontainer#100 |
Proposed change
This PR minimizes the D-Bus requirements for tests. It does this by using dbus-daemon directly instead of dbus-launch. The latter is meant for graphical applications and therefor has X11 dependencies. It also leaves the D-Bus daemon running after the tests are done. This will accumulate dbus-daemon processes over time which is not ideal.
I've also considered using dbus-run-session since it is meant to launch processes with a private D-Bus session. For Python tests one could launch it like so:
dbus-run-session -- python3 -m pytest ...
Then
DBUS_SESSION_BUS_ADDRESS
would be used automatically by theMessageBus
class. However, to keep the current behavior of the tests, launching the D-Bus daemon manually is the better option.Type of change
Additional information
Checklist
ruff format supervisor tests
)If API endpoints of add-on configuration are added/changed:
Summary by CodeRabbit
dbus_session
function to return a session address, improving connection capabilities to the D-Bus session.dbus_session
function for asynchronous execution, optimizing resource management.