-
Notifications
You must be signed in to change notification settings - Fork 671
otelconf: Increased test coverage for Prometheus-related code #7440
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7440 +/- ##
=====================================
Coverage 82.3% 82.3%
=====================================
Files 205 205
Lines 17967 17967
=====================================
+ Hits 14794 14800 +6
+ Misses 2736 2731 -5
+ Partials 437 436 -1 🚀 New features to boost your workflow:
|
assert.True(t, strings.Contains(addr, "localhost") || strings.Contains(addr, "127.0.0.1"), | ||
"server address %s should contain localhost or 127.0.0.1", addr) | ||
|
||
resp, err := http.DefaultClient.Get("http://" + server.Addr + "/metrics") |
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.
resp, err := http.DefaultClient.Get("http://" + server.Addr + "/metrics") | |
resp, err := http.DefaultClient.Get("http://" + addr + "/metrics") |
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
reader, err := prometheusReader(context.Background(), tt.config) | ||
assert.Error(t, err) |
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.
This line is redundant with the next one
assert.Error(t, err) |
if err != nil { | ||
return | ||
} |
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.
Why is it not?
require.NoError(t, err)
require.NotNil(t, reader)
WithResourceConstantLabels: &IncludeExclude{}, | ||
} | ||
reader, err := prometheusReader(context.Background(), &cfg) | ||
assert.Error(t, err) |
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.
assert.Error(t, err) |
if err != nil { | ||
return | ||
} |
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.
Why is it not?
require.NoError(t, err)
require.NotNil(t, reader)
} | ||
} | ||
|
||
func TestPrometheusReaderConfigurationOptions(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.
It this test missing for v0.3.0
?
This PR fixes #6821
Added test for prometheusReader function for both v0.3.0 & v0.2.0
Locally tested