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
feat: add version check for thanos. keep_firing_for now available #6283
feat: add version check for thanos. keep_firing_for now available #6283
Conversation
…r. starting from thanos v0.34.0 keep_firing_for is available.
You need to add test for supported and unsupported version in
|
There's also no need to keep the existing switch/case. |
…keep_firing_for, to check thanos version, which support and not support keep_firing_for.
I have pushed changes, could you guys, please, check if it's legitimately\correct? |
pkg/operator/rules_test.go
Outdated
content, _ := pr.generateRulesConfiguration(rules) | ||
if strings.Contains(content, "keep_firing_for") { | ||
t.Fatalf("expected `keep_firing_for` not to be present in PrometheusRule") | ||
testCases := []struct { |
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.
The test doesn't work as expected: the second sub-test should return a snippet with keep_firing_for
. It's because generateRulesConfiguration() mutates the rules struct.
Also the shouldDropKeepFiringForThanos
test function needs to be renamed or a new test function should be added.
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 hope I got your point.
Changes were pushed.
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.
@simonpasquier can you please check if my changes are good?
…check keep_firing_for is dropped, second - accepted
@@ -227,7 +228,7 @@ func shouldAcceptRuleWithKeepFiringForPrometheus(t *testing.T) { | |||
} | |||
} | |||
|
|||
func shouldDropKeepFiringForThanos(t *testing.T) { | |||
func shouldDropRuleFiringForThanos(t *testing.T) { |
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.
Not a big deal but you could have kept the original name?
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 made this by example of Prometheus - Accept and Drop.
And, I guess, because of now it's possible to use and that option can be Accepted and should be Dropped in case of version of thanos is "old".
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!
I guess it would be good to squash commits, but I was to late :) |
No issue, I've squashed on merge :) |
Description
Added version check for thanos in the context of keep_firing_for. starting from thanos v0.34.0 keep_firing_for is available.
Type of change
What type of changes does your code introduce to the Prometheus operator? Put an
x
in the box that apply.CHANGE
(fix or feature that would cause existing functionality to not work as expected)FEATURE
(non-breaking change which adds functionality)BUGFIX
(non-breaking change which fixes an issue)ENHANCEMENT
(non-breaking change which improves existing functionality)NONE
(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Verification
Please check the Prometheus-Operator testing guidelines for recommendations about automated tests.
Changelog entry