mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
scrape/scrape_test.go: reduce the time it takes to reload the manager (#14447)
* scrape/scrape_test.go: reduce the time it takes to reload the manager TestNativeHistogramMaxSchemaSet took over 3x5s to complete because there's a minimum reload interval. I've made the testcases run in parallel and reduced the reload interval to 10ms. Now the test runs in around 0.1-0.2 seconds. Ran test 10000 times to check if it's flaky. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com> --------- Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
parent
d5f65cfce0
commit
79a6238e19
|
@ -3773,7 +3773,9 @@ func TestNativeHistogramMaxSchemaSet(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for name, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
testNativeHistogramMaxSchemaSet(t, tc.minBucketFactor, tc.expectedSchema)
|
||||
})
|
||||
}
|
||||
|
@ -3816,8 +3818,8 @@ func testNativeHistogramMaxSchemaSet(t *testing.T, minBucketFactor string, expec
|
|||
configStr := fmt.Sprintf(`
|
||||
global:
|
||||
metric_name_validation_scheme: legacy
|
||||
scrape_interval: 1s
|
||||
scrape_timeout: 1s
|
||||
scrape_interval: 50ms
|
||||
scrape_timeout: 25ms
|
||||
scrape_configs:
|
||||
- job_name: test
|
||||
%s
|
||||
|
@ -3830,7 +3832,7 @@ scrape_configs:
|
|||
s.DB.EnableNativeHistograms()
|
||||
reg := prometheus.NewRegistry()
|
||||
|
||||
mng, err := NewManager(&Options{EnableNativeHistogramsIngestion: true}, nil, nil, s, reg)
|
||||
mng, err := NewManager(&Options{DiscoveryReloadInterval: model.Duration(10 * time.Millisecond), EnableNativeHistogramsIngestion: true}, nil, nil, s, reg)
|
||||
require.NoError(t, err)
|
||||
cfg, err := config.Load(configStr, false, log.NewNopLogger())
|
||||
require.NoError(t, err)
|
||||
|
@ -3861,7 +3863,7 @@ scrape_configs:
|
|||
countSeries++
|
||||
}
|
||||
return countSeries > 0
|
||||
}, 15*time.Second, 100*time.Millisecond)
|
||||
}, 5*time.Second, 100*time.Millisecond)
|
||||
|
||||
// Check that native histogram schema is as expected.
|
||||
q, err := s.Querier(0, math.MaxInt64)
|
||||
|
|
Loading…
Reference in a new issue