test(scrape): make nhcb scrape test more tolerant (#16862)

Fixes #16689
well, maybe not 100%, but should improve it.

Increase the scrape timeout to be more tolerant of slow test and
also use eventually when checking for targets.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
George Krajcsovits 2025-07-11 12:09:53 +02:00 committed by GitHub
parent 4662722a8e
commit dae80e66a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -4695,7 +4695,7 @@ metric: <
SampleLimit: 100,
Scheme: "http",
ScrapeInterval: model.Duration(50 * time.Millisecond),
ScrapeTimeout: model.Duration(25 * time.Millisecond),
ScrapeTimeout: model.Duration(49 * time.Millisecond),
AlwaysScrapeClassicHistograms: tc.alwaysScrapeClassicHistograms,
ConvertClassicHistogramsToNHCB: tc.convertClassicHistToNHCB,
MetricNameValidationScheme: model.UTF8Validation,
@ -4747,7 +4747,7 @@ metric: <
Targets: []model.LabelSet{{model.AddressLabel: model.LabelValue(testURL.Host)}},
},
})
require.Len(t, sp.ActiveTargets(), 1)
require.Eventually(t, func() bool { return len(sp.ActiveTargets()) == 1 }, 5*time.Second, 50*time.Millisecond)
select {
case <-time.After(5 * time.Second):