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.

test(ai): update tests for license gate removals and DeepSeek cleanup

rcourtmane780a78725c9
diff --git a/internal/ai/coverage_increase_test.go b/internal/ai/coverage_increase_test.go
index 8764cd8c0f..de9f620f47 100644
--- a/internal/ai/coverage_increase_test.go
+++ b/internal/ai/coverage_increase_test.go
@@ -16,7 +16,7 @@ func TestPatrolService_BroadcastFullChannel(t *testing.T) {
// Subscribe with a small buffer
ch := make(chan PatrolStreamEvent, 1)
ps.streamMu.Lock()
- ps.streamSubscribers[ch] = struct{}{}
+ ps.streamSubscribers[ch] = &streamSubscriber{ch: ch}
ps.streamMu.Unlock()
// Fill the channel
diff --git a/internal/api/ai_intelligence_handlers_data_additional_test.go b/internal/api/ai_intelligence_handlers_data_additional_test.go
index 684769dc16..ef37222baf 100644
--- a/internal/api/ai_intelligence_handlers_data_additional_test.go
+++ b/internal/api/ai_intelligence_handlers_data_additional_test.go
@@ -77,7 +77,9 @@ func seedCorrelationDetector(now time.Time) *ai.CorrelationDetector {
return detector
}
-func TestHandleGetPatterns_LockedWithData(t *testing.T) {
+func TestHandleGetPatterns_UnlockedWithData(t *testing.T) {
+ // License gates were removed from intelligence endpoints (9279358c).
+ // Even with allow=false, data is returned without redaction.
t.Setenv("PULSE_MOCK_MODE", "true")
handler, _ := setupAIHandlerWithIntelligence(t)
@@ -92,8 +94,8 @@ func TestHandleGetPatterns_LockedWithData(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want 200", rec.Code)
}
- if rec.Header().Get("X-License-Required") != "true" {
- t.Fatalf("expected license header to be set")
+ if rec.Header().Get("X-License-Required") != "" {
+ t.Fatalf("expected no license header after license gates removed, got %q", rec.Header().Get("X-License-Required"))
}
var resp struct {
@@ -107,11 +109,11 @@ func TestHandleGetPatterns_LockedWithData(t *testing.T) {
if resp.Count != 1 {
t.Fatalf("count = %d, want 1", resp.Count)
}
- if len(resp.Patterns) != 0 {
- t.Fatalf("expected patterns to be redacted")
+ if len(resp.Patterns) != 1 {
+ t.Fatalf("expected patterns to be returned (not redacted), got %d", len(resp.Patterns))
}
- if !resp.LicenseRequired {
- t.Fatalf("expected license_required=true")
+ if resp.LicenseRequired {
+ t.Fatalf("expected license_required=false")
}
}