-
-
Notifications
You must be signed in to change notification settings - Fork 359
Run tests in CI and fix failing tests. #1672
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import ( | |
|
||
"github.com/prometheus/client_golang/prometheus" | ||
dto "github.com/prometheus/client_model/go" | ||
"github.com/prometheus/common/model" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
@@ -71,6 +72,12 @@ func TestSanitize(t *testing.T) { | |
} | ||
|
||
func TestPromStringTag(t *testing.T) { | ||
originalValidationScheme := model.NameValidationScheme | ||
model.NameValidationScheme = model.LegacyValidation | ||
defer func() { | ||
model.NameValidationScheme = originalValidationScheme | ||
}() | ||
|
||
Comment on lines
+75
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should raise attention to the breaking changes that added utf8 support:
These two dependencies are now merged on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. Could we do this in a follow up? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do the part where we set the legacy validation in this PR? Once pandora's box is opened, I guess it's worth merging a fully usable solution. |
||
testCases := []struct { | ||
name string | ||
label string | ||
|
@@ -134,6 +141,12 @@ func TestPromStringTag(t *testing.T) { | |
} | ||
|
||
func TestNewPrometheusCollector_CanReportMetricsAndErrors(t *testing.T) { | ||
originalValidationScheme := model.NameValidationScheme | ||
model.NameValidationScheme = model.LegacyValidation | ||
defer func() { | ||
model.NameValidationScheme = originalValidationScheme | ||
}() | ||
|
||
metrics := []*PrometheusMetric{ | ||
{ | ||
Name: "this*is*not*valid", | ||
|
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.
Is it worth making scraper public as it's used only in
main.go
?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 linter was complaining about the lint being present.
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 thought I saw a nolintlint false-positive bug recently.
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.
That could be it.
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.
IIUC we could revert this specific change if it was just a false positive?