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.

Keep guest recovery fixtures compatible with command-shaped replies

pulse-triage[bot]8a32b3c03cf6
diff --git a/internal/monitoring/guest_disk_expiry_test.go b/internal/monitoring/guest_disk_expiry_test.go
index 53c860aa51..f73ac7af3e 100644
--- a/internal/monitoring/guest_disk_expiry_test.go
+++ b/internal/monitoring/guest_disk_expiry_test.go
@@ -165,8 +165,15 @@ func testGuestDiskOrdinaryDeferralExpiryAndRecovery(t *testing.T) {
used = 0 // A measured zero is a successful recovery.
}
fmt.Fprintf(w, `{"data":{"result":[{"mountpoint":"C:\\","type":"ntfs","total-bytes":%d,"used-bytes":%d}]}}`, 1000*mib, used)
- } else {
+ } else if strings.HasSuffix(r.URL.Path, "/get-osinfo") || strings.HasSuffix(r.URL.Path, "/info") {
+ // Unknown metadata is a valid empty object, not a
+ // foreign list that must pause shared command admission.
+ fmt.Fprint(w, `{"data":{"result":{}}}`)
+ } else if strings.HasSuffix(r.URL.Path, "/network-get-interfaces") {
fmt.Fprint(w, `{"data":{"result":[]}}`)
+ } else {
+ t.Errorf("unexpected guest command: %s", r.URL.Path)
+ http.NotFound(w, r)
}
default:
http.NotFound(w, r)
diff --git a/internal/monitoring/guest_filesystem_alias_usage_test.go b/internal/monitoring/guest_filesystem_alias_usage_test.go
index d6bc03d16d..ceb61d37ce 100644
--- a/internal/monitoring/guest_filesystem_alias_usage_test.go
+++ b/internal/monitoring/guest_filesystem_alias_usage_test.go
@@ -108,7 +108,9 @@ func TestVMFilesystemAliasUsagePollingAndHistory(t *testing.T) {
rows = []any{row("/", 0), row("/bind", 0)}
}
_ = json.NewEncoder(w).Encode(map[string]any{"data": map[string]any{"result": rows}})
- case strings.Contains(r.URL.Path, "/agent/"):
+ case strings.HasSuffix(r.URL.Path, "/agent/get-osinfo"), strings.HasSuffix(r.URL.Path, "/agent/info"):
+ fmt.Fprint(w, `{"data":{"result":{}}}`)
+ case strings.HasSuffix(r.URL.Path, "/agent/network-get-interfaces"):
fmt.Fprint(w, `{"data":{"result":[]}}`)
default:
t.Errorf("unexpected request: %s", r.URL.Path)
diff --git a/internal/monitoring/guest_filesystem_completeness_test.go b/internal/monitoring/guest_filesystem_completeness_test.go
index d4e53a1aa2..e8377009f9 100644
--- a/internal/monitoring/guest_filesystem_completeness_test.go
+++ b/internal/monitoring/guest_filesystem_completeness_test.go
@@ -86,7 +86,9 @@ func TestVMFilesystemIncompletePollingPreservesHistoryAndBreach(t *testing.T) {
rows = `{"mountpoint":"/","type":"ext4","disk":[{"dev":"/dev/vda1"}],"total-bytes":1000,"used-bytes":0}`
}
fmt.Fprintf(w, `{"data":{"result":[%s]}}`, rows)
- case strings.Contains(r.URL.Path, "/agent/"):
+ case strings.HasSuffix(r.URL.Path, "/agent/get-osinfo"), strings.HasSuffix(r.URL.Path, "/agent/info"):
+ fmt.Fprint(w, `{"data":{"result":{}}}`)
+ case strings.HasSuffix(r.URL.Path, "/agent/network-get-interfaces"):
fmt.Fprint(w, `{"data":{"result":[]}}`)
default:
t.Errorf("unexpected request: %s", r.URL.Path)
diff --git a/internal/monitoring/guest_memory_capacity_test.go b/internal/monitoring/guest_memory_capacity_test.go
index 11b1b57888..e60cb23d7b 100644
--- a/internal/monitoring/guest_memory_capacity_test.go
+++ b/internal/monitoring/guest_memory_capacity_test.go
@@ -149,10 +149,13 @@ func testGuestMemorySampleCapacityPolling(t *testing.T) {
fmt.Fprintf(w, `{"data":{"result":[{"mountpoint":"/","type":"ext4","total-bytes":%d,"used-bytes":%d}]}}`, gib, gib/4)
case strings.HasSuffix(r.URL.Path, "/get-osinfo"):
fmt.Fprint(w, `{"data":{"name":"Linux","version":"fixture"}}`)
- case strings.HasSuffix(r.URL.Path, "/version"):
+ case strings.HasSuffix(r.URL.Path, "/info"):
fmt.Fprint(w, `{"data":{"result":{"version":"fixture"}}}`)
- default:
+ case strings.HasSuffix(r.URL.Path, "/network-get-interfaces"):
fmt.Fprint(w, `{"data":{"result":[]}}`)
+ default:
+ t.Errorf("unexpected guest command: %s", r.URL.Path)
+ http.NotFound(w, r)
}
case strings.HasSuffix(r.URL.Path, "/version"):
fmt.Fprint(w, `{"data":{"version":"9.2-fixture"}}`)