-
Notifications
You must be signed in to change notification settings - Fork 897
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
Add target to event existence check #15719
Conversation
11fa648
to
f9b3c9b
Compare
@miq-bot add_label events, enhancement |
This makes sense @moolitayer. Can you add a test that recreates the issue and demonstrates how your change fixes it? |
Seems good to me. Agree on adding a spec. |
f9b3c9b
to
af43ef6
Compare
@@ -196,6 +197,27 @@ | |||
expect(new_event.availability_zone_id).to eq @availability_zone.id | |||
end | |||
end | |||
|
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.
".add" context is nested under "with availability zones"
Not sure if it's less confusing to add the new context here or create another top level ".add" context
2adfcc9
to
450e8c0
Compare
spec/models/ems_event_spec.rb
Outdated
@@ -196,6 +198,24 @@ | |||
expect(new_event.availability_zone_id).to eq @availability_zone.id | |||
end | |||
end | |||
|
|||
context "when two events have the same timestamp" do | |||
context "when events belong to the same object" do |
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.
Were you going to add another test here? If not, we can probably collapse these two contexts into one.
spec/models/ems_event_spec.rb
Outdated
it "should add only one of them" do | ||
EmsEvent.add(@ems.id, @event_hash) | ||
second = EmsEvent.add(@ems.id, @event_hash) | ||
expect(second).to be_nil |
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.
Should we check that there is only one EmsEvent row for the event hash details instead of checking the return value from add
?
spec/models/ems_event_spec.rb
Outdated
it "should add them both" do | ||
EmsEvent.add(@ems.id, @event_hash) | ||
second = EmsEvent.add(@ems.id, @event_hash.update(:target_id => 1)) | ||
expect(second).not_to be_nil |
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.
Same as above.
sorry @moolitayer, I didn't see this update. I had a few minor comments on the tests. Please keep mentioning me until I see it and respond 😉 |
aa29dd7
to
1d4ba5a
Compare
1d4ba5a
to
e368740
Compare
Checked commit moolitayer@e368740 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 spec/models/ems_event_spec.rb
|
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.
Looks good 👍
In Prometheus alerting if in one evaluation cycle, the same alert was first found to be firing
for different labels (==entities) we will get multiple alerts indistinguishable by timestamp[1]
[1]
Example, for both
"startsAt": "2017-08-02T10:16:30.457040707Z"
and there is no other time related difference: