-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix: remove unnecessary leadership guards in GrafanaCloudConfigRequirer #13
Conversation
cd94f01
to
9bb6da5
Compare
Previously, GrafanaCloudConfigRequirer would only emit a cloud_config_* event on relation changed/broken if this unit is a leader. This caused issues with multi-unit deployments as described in [#12](#12). Since GrafanaCloudConfigRequirer only reads the relation remote's application_data, there is no need for a leadership guard because non-leader units have permission to read this data. The current commit removes these guards.
9bb6da5
to
a6f5787
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think the change is going in the right direction, as it's odd to emit custom events conditionally on leadership.
However, I was expecting to see some documentation changes? Is there nothing in the module docstring that we need to adjust to reflect the change? (if not, it was probably a bad doc and we should create an issue to improve the documentation)
Secondly, I was expecting to see some test for the new behaviour.
A couple of simple tests using Context.emitted_events
to verify that the available/revoked events are emitted regardless of leadership would be great.
Yep good points.
|
7c35bfd
to
77abb21
Compare
@PietroPasotti added some tests like you mentioned to assert the correct events are emitted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tests! On top of the missing assertions spotted by leon, the fixtures should be cleaned up a bit.
The rest looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would merge it as is and address the comments made in the created issues.
Dismissing given Jose's review. I think everything is resolved, but if not we can update it after
Issue
Previously, GrafanaCloudConfigRequirer would only emit a cloud_config_* event on relation changed/broken if this unit is a leader. This caused issues with multi-unit deployments as described in #12.
Solution
Since GrafanaCloudConfigRequirer only reads the relation remote's application_data, there is no need for a leadership guard because non-leader units have permission to read this data. The current commit removes these guards.
Context
closes #12
Testing Instructions
See this grafana-agent patch for testing instructions
Release Notes