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: normalize version strings with build metadata in tests

rcourtmane367cd384ef0
diff --git a/internal/api/router_integration_test.go b/internal/api/router_integration_test.go
index d4af24bc44..6073e606ae 100644
--- a/internal/api/router_integration_test.go
+++ b/internal/api/router_integration_test.go
@@ -571,11 +571,12 @@ func TestSessionCookieAllowsAuthenticatedAccess(t *testing.T) {
func readExpectedVersion(t *testing.T) string {
t.Helper()
- versionPath := filepath.Join("VERSION")
+ // Try to read VERSION from repository root
+ versionPath := filepath.Join("..", "..", "VERSION")
data, err := os.ReadFile(versionPath)
if err != nil {
// Fall back to the hard-coded fallback in version manager
- return "4.24.0-rc.1"
+ return "4.24.0"
}
return strings.TrimSpace(string(data))
}
@@ -584,8 +585,13 @@ func normalizeVersion(v string) string {
v = strings.TrimSpace(v)
v = strings.TrimPrefix(v, "v")
v = strings.TrimSuffix(v, "-dirty")
+ // Strip pre-release metadata (after '-')
if idx := strings.IndexByte(v, '-'); idx >= 0 {
v = v[:idx]
}
+ // Strip build metadata (after '+')
+ if idx := strings.IndexByte(v, '+'); idx >= 0 {
+ v = v[:idx]
+ }
return v
}