Fix discovery test Prometheus metric collision

Remove t.Parallel() from tests that verify global Prometheus gauge values.
When tests run in parallel, they update the same global gauges
(discoveryScanServers, discoveryScanErrors) causing race conditions and
incorrect metric values.

Fixes test failure in workflow run 19281332332:
- TestPerformScanRecordsHistoryAndMetrics expected 2 servers, got 1

Related to release workflow preflight tests.
This commit is contained in:
rcourtman 2025-11-11 23:34:49 +00:00
parent b41f8a2ac4
commit bbe11d1e7f

View file

@ -35,8 +35,6 @@ func (f *fakeScanner) DiscoverServersWithCallbacks(ctx context.Context, subnet s
}
func TestPerformScanRecordsHistoryAndMetrics(t *testing.T) {
t.Parallel()
service := NewService(nil, time.Minute, "192.168.1.0/24", func() config.DiscoveryConfig {
cfg := config.DefaultDiscoveryConfig()
cfg.SubnetBlocklist = []string{"10.0.0.0/24", "172.16.0.0/24"}
@ -103,8 +101,6 @@ func TestPerformScanRecordsHistoryAndMetrics(t *testing.T) {
}
func TestPerformScanRecordsPartialFailure(t *testing.T) {
t.Parallel()
service := NewService(nil, time.Minute, "auto", func() config.DiscoveryConfig {
cfg := config.DefaultDiscoveryConfig()
return cfg