File tree 3 files changed +25
-1
lines changed
3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 10
10
workflow_call :
11
11
12
12
jobs :
13
+ test_go :
14
+ name : Go tests
15
+ runs-on : ubuntu-latest
16
+ container :
17
+ image : quay.io/prometheus/golang-builder:1.23-base
18
+ steps :
19
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20
+ - uses : prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
21
+ - uses : ./.github/promci/actions/setup_environment
22
+ - run : go test ./pkg/...
23
+
13
24
build :
14
25
name : Build for common architectures
15
26
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ type cachingFactory interface {
38
38
Clear ()
39
39
}
40
40
41
- func NewScraper (featureFlags []string ) * scraper { //nolint:revive
41
+ func NewScraper (featureFlags []string ) * scraper {
42
42
s := & scraper {
43
43
registry : atomic.Pointer [prometheus.Registry ]{},
44
44
featureFlags : featureFlags ,
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
18
18
19
19
"github.com/prometheus/client_golang/prometheus"
20
20
dto "github.com/prometheus/client_model/go"
21
+ "github.com/prometheus/common/model"
21
22
"github.com/stretchr/testify/assert"
22
23
"github.com/stretchr/testify/require"
23
24
)
@@ -71,6 +72,12 @@ func TestSanitize(t *testing.T) {
71
72
}
72
73
73
74
func TestPromStringTag (t * testing.T ) {
75
+ originalValidationScheme := model .NameValidationScheme
76
+ model .NameValidationScheme = model .LegacyValidation
77
+ defer func () {
78
+ model .NameValidationScheme = originalValidationScheme
79
+ }()
80
+
74
81
testCases := []struct {
75
82
name string
76
83
label string
@@ -134,6 +141,12 @@ func TestPromStringTag(t *testing.T) {
134
141
}
135
142
136
143
func TestNewPrometheusCollector_CanReportMetricsAndErrors (t * testing.T ) {
144
+ originalValidationScheme := model .NameValidationScheme
145
+ model .NameValidationScheme = model .LegacyValidation
146
+ defer func () {
147
+ model .NameValidationScheme = originalValidationScheme
148
+ }()
149
+
137
150
metrics := []* PrometheusMetric {
138
151
{
139
152
Name : "this*is*not*valid" ,
You can’t perform that action at this time.
0 commit comments