web: prepare TestFederation_NotReady test for parallel execution
Later on in the test we override fields of handler, so we need a handler
per sub-test, rather than a global one.
@@ -253,18 +253,19 @@ func (notReadyReadStorage) Stats(string) (*tsdb.Stats, error) {
// Regression test for https://github.com/prometheus/prometheus/issues/7181.
func TestFederation_NotReady(t *testing.T) {
+ for name, scenario := range scenarios {
+ t.Run(name, func(t *testing.T) {
h := &Handler{
localStorage: notReadyReadStorage{},
lookbackDelta: 5 * time.Minute,
now: func() model.Time { return 101 * 60 * 1000 }, // 101min after epoch.
config: &config.Config{
- GlobalConfig: config.GlobalConfig{},
+ GlobalConfig: config.GlobalConfig{
+ ExternalLabels: scenario.externalLabels,
+ },
},
}
- for name, scenario := range scenarios {
- t.Run(name, func(t *testing.T) {
- h.config.GlobalConfig.ExternalLabels = scenario.externalLabels
req := httptest.NewRequest("GET", "http://example.org/federate?"+scenario.params, nil)
res := httptest.NewRecorder()
