Skip to content
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

cmd/snap, userd, testutil: tweak DBus tests to use private session bus connection #6049

Merged
merged 3 commits into from Oct 26, 2018

Conversation

bboozzoo
Copy link
Collaborator

Shared connections have special requirements for lifetime management. In particular methods such as dbus.Conn.Close() must not be called on shared connections. Refactor the code to use private bus connections which do not have such limitations. This also makes the test suite code use a different connection object than the code being tested.

DBus test suite must use a private connection to the session bus to avoid
potential problems with other code using a shared connection. Especially, avoid
using the same connecion as code under test.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Do not use the shared connection to avoid potential conflicts with other code.
In particular, managing the lifetime of a shared connection is error prone as
Close() must not be called for shared connections, but can safely be called for
private ones.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Tweak the code for testing userd's session bus support and name registration.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Copy link
Contributor

@chipaca chipaca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve.

Copy link
Contributor

@chipaca chipaca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve thrice

Copy link
Collaborator

@zyga zyga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the extra explanation on IRC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants