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

Fixing notification groups deep equal bug #43

Merged
merged 3 commits into from
Aug 3, 2023

Conversation

OrNovo
Copy link
Contributor

@OrNovo OrNovo commented Aug 3, 2023

It turns out that NotificationGroups and Notifications within each NotificationGroup do not maintain the creation order, therefore a different type of comparison between spec and status is needed.

…p the order of creation, required different kind of comparison
…p the order of creation, required different kind of comparison
@OrNovo OrNovo requested a review from a team as a code owner August 3, 2023 14:10
nicolastakashi
nicolastakashi previously approved these changes Aug 3, 2023
Copy link
Contributor

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

therefore a different type of comparison between spec and status is needed.

Could you elaborate on what is this "different type of comparison"? It's a bit hard to understand just by reading the code

And nice find discovering that the API doesn't return notification groups ordered. I'm not sure if your solution works as expected though, maps are not ordered in golang, so I'm not sure if using a map is helping here

One easy way to make sure that your function is working is by adding a unit test :)

apis/coralogix/v1alpha1/alert_types.go Show resolved Hide resolved
@OrNovo
Copy link
Contributor Author

OrNovo commented Aug 3, 2023

therefore a different type of comparison between spec and status is needed.

Could you elaborate on what is this "different type of comparison"? It's a bit hard to understand just by reading the code

And nice find discovering that the API doesn't return notification groups ordered. I'm not sure if your solution works as expected though, maps are not ordered in golang, so I'm not sure if using a map is helping here

One easy way to make sure that your function is working is by adding a unit test :)

Notifications-Groups are unique by their group-by arrays.
Also Notifications are unique by their integration-name/id

So I create map of group-by->[]Notification and compare, then, for the Notification list I create map of integration->Notification and compare.

I agree about the unit-test, but since it's blocking you let's add an issue about it and merge this PR.
WDYT?

@ArthurSens
Copy link
Contributor

Notifications-Groups are unique by their group-by arrays.
Also Notifications are unique by their integration-name/id

So I create map of group-by->[]Notification and compare, then, for the Notification list I create map of integration->Notification and compare.

Thanks for the explanation!

I agree about the unit-test, but since it's blocking you let's add an issue about it and merge this PR.
WDYT?

Well, I'm a bit concerned about a pattern that I'm noticing here 😬. Whenever we deploy the operator in an environment we need to fight against a series of bugs. Having so many bugs is what is blocking us the most, and not this specific PR. I'm completely fine with waiting longer to deploy the operator in other environments if in return we are creating a culture of not delivering stuff untested.

Copy link
Contributor

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

So sorry for being annoying, and thanks for your patience and quick resolution ❤️

@OrNovo
Copy link
Contributor Author

OrNovo commented Aug 3, 2023

So sorry for being annoying, and thanks for your patience and quick resolution ❤️

NP, I'll talk with Oded about prioritize adding tests. Currently focusing on adding validations.

@OrNovo OrNovo merged commit 9f5fe52 into main Aug 3, 2023
4 of 5 checks passed
@OrNovo OrNovo deleted the fixing_NotificationGroups_DeepEqual_bug branch August 3, 2023 16:16
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