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

Fixes for the brokers package #8

Merged
merged 7 commits into from
Aug 4, 2023
Merged

Conversation

denisonbarbosa
Copy link
Member

When writing the tests, some problems emerged that demanded some fixing.
The details of each individual fix are contained in the commit messages.

Since we gracefully handle a cancellation call for IsAuthorized, we need
to wait for the routine to return and close the done channel when
CancelIsAuthorized is called, otherwise it just progresses the main
routine without waiting for the expected values.
The previous calls for IsAuthorized and CancelIsAuthorized were using
CallWithContext, which would associate the specified context with the
calls. Since we rely on context cancelation to properly cancel the
IsAuthorized operation on the Broker, we can't use the same context on
the dbus call as it would result in the whole call being cancelled.

Now they use Call instead, which uses context.Backgroung() by default.
@denisonbarbosa denisonbarbosa requested a review from a team as a code owner August 4, 2023 12:17
Copy link
Contributor

@GabrielNagy GabrielNagy left a comment

Choose a reason for hiding this comment

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

The changes look sensible to me, and I appreciate the splitting into separate, atomic commits 👍

Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

I think the rootDir usage is on purpose to avoid duplicating the path from the caller side in integration tests. It might be neeed to be reverted.

The rest of the changes looks good to me!

internal/brokers/manager.go Outdated Show resolved Hide resolved
This allows us to use the examplebroker on the brokers package without
having issues with import cycles.
In order to be able to continue using the examplebroker locally, some
methods need to be public in order to be accessed in the brokers package
When moving examplebroker to a new package, the creation of those
brokers got affected and they were being created with an empty interface
that couldn't be used for tests. Now they are examplebrokers.
The function dbus.ConnectSystemBus() does exactly the same thing we were
doing by using dbus.PrivateSystemBus() and then having to manually Auth
and Hello, so it's better to use the ConnectSystemBus() one.
Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

Excellent! :)

@denisonbarbosa denisonbarbosa merged commit eb81927 into main Aug 4, 2023
3 checks passed
@denisonbarbosa denisonbarbosa deleted the fixes-for-broker-package branch August 4, 2023 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants