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: Add edge case tests for parseWearoutValue function

rcourtman2afc7f0c416f
diff --git a/pkg/proxmox/client_test.go b/pkg/proxmox/client_test.go
index 765113d139..dab4428283 100644
--- a/pkg/proxmox/client_test.go
+++ b/pkg/proxmox/client_test.go
@@ -723,6 +723,12 @@ func TestParseWearoutValue(t *testing.T) {
{name: "float zero decimal", raw: "90.0", want: 90},
{name: "float high precision", raw: "75.999", want: 75},
{name: "negative float", raw: "-5.5", want: -5},
+ {name: "float zero exactly", raw: "0.0", want: 0},
+ {name: "float negative zero", raw: "-0.0", want: 0},
+
+ // Quoted values that become empty after trimming
+ {name: "only escaped quotes", raw: `\"\"`, want: wearoutUnknown},
+ {name: "quoted whitespace", raw: `" "`, want: wearoutUnknown},
// Digit extraction fallback (messy SMART data)
{name: "percentage text mixed", raw: "about 50 percent", want: 50},