Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix: data race in Docker detection test mock — add mutex for concurrent calls

rcourtmana61f1b387aad
diff --git a/internal/monitoring/docker_detection_test.go b/internal/monitoring/docker_detection_test.go
index 72cba2cbd6..55bd8c779a 100644
--- a/internal/monitoring/docker_detection_test.go
+++ b/internal/monitoring/docker_detection_test.go
@@ -2,6 +2,7 @@ package monitoring
import (
"context"
+ "sync"
"testing"
"time"
@@ -11,11 +12,14 @@ import (
// mockDockerChecker is a test implementation of DockerChecker
type mockDockerChecker struct {
results map[int]bool // vmid -> hasDocker
- calls []int // records vmids that were checked
+ mu sync.Mutex
+ calls []int // records vmids that were checked
}
func (m *mockDockerChecker) CheckDockerInContainer(ctx context.Context, node string, vmid int) (bool, error) {
+ m.mu.Lock()
m.calls = append(m.calls, vmid)
+ m.mu.Unlock()
if hasDocker, ok := m.results[vmid]; ok {
return hasDocker, nil
}