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: Update tests for RAID alerting md0/md1 skip and AI gating message change

rcourtman2b68bfe6eedc
diff --git a/internal/alerts/alerts_test.go b/internal/alerts/alerts_test.go
index feb99a10da..397bdf00dc 100644
--- a/internal/alerts/alerts_test.go
+++ b/internal/alerts/alerts_test.go
@@ -13226,7 +13226,7 @@ func TestCheckHostComprehensive(t *testing.T) {
Hostname: "testhost",
RAID: []models.HostRAIDArray{
{
- Device: "/dev/md0",
+ Device: "/dev/md2", // Note: md0/md1 are skipped for Synology compatibility
Level: "raid1",
State: "degraded",
TotalDevices: 2,
@@ -13239,7 +13239,7 @@ func TestCheckHostComprehensive(t *testing.T) {
m.CheckHost(host)
m.mu.RLock()
- alert := m.activeAlerts["host-host1-raid-md0"]
+ alert := m.activeAlerts["host-host1-raid-md2"]
m.mu.RUnlock()
if alert == nil {
@@ -13259,7 +13259,7 @@ func TestCheckHostComprehensive(t *testing.T) {
Hostname: "testhost",
RAID: []models.HostRAIDArray{
{
- Device: "/dev/md0",
+ Device: "/dev/md2", // Note: md0/md1 are skipped for Synology compatibility
Level: "raid1",
State: "recovering",
TotalDevices: 2,
@@ -13273,7 +13273,7 @@ func TestCheckHostComprehensive(t *testing.T) {
m.CheckHost(host)
m.mu.RLock()
- alert := m.activeAlerts["host-host1-raid-md0"]
+ alert := m.activeAlerts["host-host1-raid-md2"]
m.mu.RUnlock()
if alert == nil {
@@ -13289,8 +13289,8 @@ func TestCheckHostComprehensive(t *testing.T) {
m := newTestManager(t)
m.mu.Lock()
- m.activeAlerts["host-host1-raid-md0"] = &Alert{
- ID: "host-host1-raid-md0",
+ m.activeAlerts["host-host1-raid-md2"] = &Alert{
+ ID: "host-host1-raid-md2",
Type: "raid",
Level: AlertLevelCritical,
}
@@ -13301,7 +13301,7 @@ func TestCheckHostComprehensive(t *testing.T) {
Hostname: "testhost",
RAID: []models.HostRAIDArray{
{
- Device: "/dev/md0",
+ Device: "/dev/md2", // Note: md0/md1 are skipped for Synology compatibility
Level: "raid1",
State: "active",
TotalDevices: 2,
@@ -13314,7 +13314,7 @@ func TestCheckHostComprehensive(t *testing.T) {
m.CheckHost(host)
m.mu.RLock()
- _, exists := m.activeAlerts["host-host1-raid-md0"]
+ _, exists := m.activeAlerts["host-host1-raid-md2"]
m.mu.RUnlock()
if exists {
@@ -13331,7 +13331,7 @@ func TestCheckHostComprehensive(t *testing.T) {
Hostname: "testhost",
RAID: []models.HostRAIDArray{
{
- Device: "/dev/md0",
+ Device: "/dev/md2", // Note: md0/md1 are skipped for Synology compatibility
Level: "raid1",
State: "active", // State might say active but with failed devices
TotalDevices: 2,
@@ -13344,7 +13344,7 @@ func TestCheckHostComprehensive(t *testing.T) {
m.CheckHost(host)
m.mu.RLock()
- alert := m.activeAlerts["host-host1-raid-md0"]
+ alert := m.activeAlerts["host-host1-raid-md2"]
m.mu.RUnlock()
if alert == nil {
@@ -13364,7 +13364,7 @@ func TestCheckHostComprehensive(t *testing.T) {
Hostname: "testhost",
RAID: []models.HostRAIDArray{
{
- Device: "/dev/md0",
+ Device: "/dev/md2", // Note: md0/md1 are skipped for Synology compatibility
Level: "raid1",
State: "resync",
TotalDevices: 2,
@@ -13377,7 +13377,7 @@ func TestCheckHostComprehensive(t *testing.T) {
m.CheckHost(host)
m.mu.RLock()
- alert := m.activeAlerts["host-host1-raid-md0"]
+ alert := m.activeAlerts["host-host1-raid-md2"]
m.mu.RUnlock()
if alert == nil {
@@ -13394,8 +13394,8 @@ func TestCheckHostComprehensive(t *testing.T) {
originalTime := time.Now().Add(-1 * time.Hour)
m.mu.Lock()
- m.activeAlerts["host-host1-raid-md0"] = &Alert{
- ID: "host-host1-raid-md0",
+ m.activeAlerts["host-host1-raid-md2"] = &Alert{
+ ID: "host-host1-raid-md2",
Type: "raid",
Level: AlertLevelCritical,
StartTime: originalTime,
@@ -13407,7 +13407,7 @@ func TestCheckHostComprehensive(t *testing.T) {
Hostname: "testhost",
RAID: []models.HostRAIDArray{
{
- Device: "/dev/md0",
+ Device: "/dev/md2", // Note: md0/md1 are skipped for Synology compatibility
Level: "raid1",
State: "degraded",
TotalDevices: 2,
@@ -13420,7 +13420,7 @@ func TestCheckHostComprehensive(t *testing.T) {
m.CheckHost(host)
m.mu.RLock()
- alert := m.activeAlerts["host-host1-raid-md0"]
+ alert := m.activeAlerts["host-host1-raid-md2"]
m.mu.RUnlock()
if alert == nil {
diff --git a/internal/api/ai_intelligence_handlers_test.go b/internal/api/ai_intelligence_handlers_test.go
index 183863f30e..c74039aa45 100644
--- a/internal/api/ai_intelligence_handlers_test.go
+++ b/internal/api/ai_intelligence_handlers_test.go
@@ -59,7 +59,7 @@ func TestHandleGetPatterns_NoPatrolService(t *testing.T) {
if len(patterns) != 0 {
t.Fatalf("expected empty patterns, got %d", len(patterns))
}
- if resp["message"] != "Patrol service not initialized" {
+ if resp["message"] != "AI is not enabled" {
t.Fatalf("unexpected message: %v", resp["message"])
}
}
@@ -132,7 +132,7 @@ func TestHandleGetPredictions_NoPatrolService(t *testing.T) {
if len(predictions) != 0 {
t.Fatalf("expected empty predictions, got %d", len(predictions))
}
- if resp["message"] != "Patrol service not initialized" {
+ if resp["message"] != "AI is not enabled" {
t.Fatalf("unexpected message: %v", resp["message"])
}
}
@@ -201,7 +201,7 @@ func TestHandleGetCorrelations_NoPatrolService(t *testing.T) {
if len(correlations) != 0 {
t.Fatalf("expected empty correlations, got %d", len(correlations))
}
- if resp["message"] != "Patrol service not initialized" {
+ if resp["message"] != "AI is not enabled" {
t.Fatalf("unexpected message: %v", resp["message"])
}
}
@@ -269,7 +269,7 @@ func TestHandleGetRecentChanges_NoPatrolService(t *testing.T) {
if len(changes) != 0 {
t.Fatalf("expected empty changes, got %d", len(changes))
}
- if resp["message"] != "Patrol service not initialized" {
+ if resp["message"] != "AI is not enabled" {
t.Fatalf("unexpected message: %v", resp["message"])
}
}
@@ -314,7 +314,7 @@ func TestHandleGetRemediations_NoPatrolService(t *testing.T) {
if len(remediations) != 0 {
t.Fatalf("expected empty remediations, got %d", len(remediations))
}
- if resp["message"] != "Patrol service not initialized" {
+ if resp["message"] != "AI is not enabled" {
t.Fatalf("unexpected message: %v", resp["message"])
}
}
@@ -359,7 +359,7 @@ func TestHandleGetBaselines_NoPatrolService(t *testing.T) {
if len(baselines) != 0 {
t.Fatalf("expected empty baselines, got %d", len(baselines))
}
- if resp["message"] != "Patrol service not initialized" {
+ if resp["message"] != "AI is not enabled" {
t.Fatalf("unexpected message: %v", resp["message"])
}
}