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.

Add legacy issue regression coverage

rcourtman20b7d6788d9b
diff --git a/internal/monitoring/monitor_extra_coverage_test.go b/internal/monitoring/monitor_extra_coverage_test.go
index 76c4da1dfa..7f37abf3fa 100644
--- a/internal/monitoring/monitor_extra_coverage_test.go
+++ b/internal/monitoring/monitor_extra_coverage_test.go
@@ -1770,6 +1770,47 @@ func TestBuildVMFromClusterResource_PrefersLinkedHostAgentDiskInventoryOverGuest
}
}
+func TestSummarizeVMFSInfoIncludesCentOSXFSFilesystems(t *testing.T) {
+ monitor := &Monitor{}
+ fsInfo := []proxmox.VMFileSystem{
+ {
+ Mountpoint: "/",
+ Type: "xfs",
+ TotalBytes: 75151441920,
+ UsedBytes: 32212254720,
+ Disk: "/dev/dm-0",
+ },
+ {
+ Mountpoint: "/boot",
+ Type: "xfs",
+ TotalBytes: 1072693248,
+ UsedBytes: 268435456,
+ Disk: "/dev/sda2",
+ },
+ }
+
+ summary := monitor.summarizeVMFSInfo(
+ "cluster-a",
+ proxmox.ClusterResource{Name: "centos-stream", VMID: 1376},
+ fsInfo,
+ )
+
+ const wantTotal = uint64(75151441920 + 1072693248)
+ const wantUsed = uint64(32212254720 + 268435456)
+ if summary.totalBytes != wantTotal || summary.usedBytes != wantUsed {
+ t.Fatalf("summary bytes = total %d used %d, want total %d used %d", summary.totalBytes, summary.usedBytes, wantTotal, wantUsed)
+ }
+ if len(summary.individualDisks) != 2 {
+ t.Fatalf("expected both CentOS XFS filesystems in the disk inventory, got %+v", summary.individualDisks)
+ }
+ if root := summary.individualDisks[0]; root.Type != "xfs" || root.Mountpoint != "/" || root.Device != "/dev/dm-0" {
+ t.Fatalf("unexpected CentOS root disk projection: %+v", root)
+ }
+ if boot := summary.individualDisks[1]; boot.Type != "xfs" || boot.Mountpoint != "/boot" || boot.Device != "/dev/sda2" {
+ t.Fatalf("unexpected CentOS boot disk projection: %+v", boot)
+ }
+}
+
func TestSummarizeVMFSInfoCountsIssue1319WindowsVolumes(t *testing.T) {
monitor := &Monitor{}
fsInfo := []proxmox.VMFileSystem{
diff --git a/pkg/proxmox/client_api_more3_test.go b/pkg/proxmox/client_api_more3_test.go
index 0628fa6d18..12a4aafc58 100644
--- a/pkg/proxmox/client_api_more3_test.go
+++ b/pkg/proxmox/client_api_more3_test.go
@@ -54,6 +54,37 @@ func TestClientVMFSInfoParsing(t *testing.T) {
}
}
+func TestClientVMFSInfoParsingCentOSXFSResult(t *testing.T) {
+ client := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
+ switch r.URL.Path {
+ case "/api2/json/nodes/pve1/qemu/1376/agent/get-fsinfo":
+ w.Header().Set("Content-Type", "application/json")
+ _, _ = w.Write([]byte(`{"data":{"result":[
+ {"name":"/dev/mapper/cs-root","type":"xfs","mountpoint":"/","total-bytes":"75151441920","used-bytes":"32212254720","disk":{"dev":"/dev/dm-0","bus-type":"scsi"}},
+ {"name":"/dev/sda2","type":"xfs","mountpoint":"/boot","total-bytes":1072693248,"used-bytes":268435456,"disk":[{"dev":"/dev/sda2","bus-type":"scsi"}]}
+ ]}}`))
+ default:
+ http.NotFound(w, r)
+ }
+ })
+
+ filesystems, err := client.GetVMFSInfo(context.Background(), "pve1", 1376)
+ if err != nil {
+ t.Fatalf("GetVMFSInfo error: %v", err)
+ }
+ if len(filesystems) != 2 {
+ t.Fatalf("expected CentOS root and boot filesystems, got %+v", filesystems)
+ }
+ if root := filesystems[0]; root.Type != "xfs" || root.Mountpoint != "/" ||
+ root.TotalBytes != 75151441920 || root.UsedBytes != 32212254720 || root.Disk != "/dev/dm-0" {
+ t.Fatalf("unexpected CentOS root filesystem: %+v", root)
+ }
+ if boot := filesystems[1]; boot.Type != "xfs" || boot.Mountpoint != "/boot" ||
+ boot.TotalBytes != 1072693248 || boot.UsedBytes != 268435456 || boot.Disk != "/dev/sda2" {
+ t.Fatalf("unexpected CentOS boot filesystem: %+v", boot)
+ }
+}
+
func TestClientVMFSInfoParsingPrivilegedCapacityFallback(t *testing.T) {
client := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
diff --git a/scripts/installtests/root_install_sh_test.go b/scripts/installtests/root_install_sh_test.go
index f5367725b8..aabb7fef1e 100644
--- a/scripts/installtests/root_install_sh_test.go
+++ b/scripts/installtests/root_install_sh_test.go
@@ -89,6 +89,29 @@ func TestRootInstallScriptArchiveSupportContract(t *testing.T) {
}
}
+func TestRootInstallScriptStagesUpdateBeforeStoppingService(t *testing.T) {
+ downloadPulse := extractRootInstallShellFunction(t, "download_pulse")
+ orderedSteps := []string{
+ `ensure_update_disk_headroom "/tmp" "$INSTALL_DIR"`,
+ `download_release_archive "$LATEST_RELEASE" "$pulse_arch" "$archive_path"`,
+ `run_upgrade_readiness_preflight "$CURRENT_VERSION" "$expected_release"`,
+ `safe_systemctl stop "$EXISTING_SERVICE"`,
+ `install_pulse_archive "$archive_path" "$expected_release"`,
+ }
+
+ previous := -1
+ for _, step := range orderedSteps {
+ position := strings.Index(downloadPulse, step)
+ if position < 0 {
+ t.Fatalf("download_pulse missing update safety step: %s", step)
+ }
+ if position <= previous {
+ t.Fatalf("download_pulse update safety steps are out of order at: %s", step)
+ }
+ previous = position
+ }
+}
+
func TestRootInstallScriptInstallsSignatureVerificationDependencies(t *testing.T) {
content, err := os.ReadFile(filepath.Join("..", "..", "install.sh"))
if err != nil {