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.

Give update-check test fixtures the exact runtime archive

[email protected]130fc6106197
diff --git a/internal/updates/issue2285_update_check_observation_test.go b/internal/updates/issue2285_update_check_observation_test.go
index cc26e2bd4e..e0ce58c54a 100644
--- a/internal/updates/issue2285_update_check_observation_test.go
+++ b/internal/updates/issue2285_update_check_observation_test.go
@@ -35,8 +35,9 @@ func issue2285Releases(t *testing.T, releases ...ReleaseInfo) string {
func TestIssue2285LastUpdateCheckRecordsEffectiveChannelOutcome(t *testing.T) {
setRetrySettingsForTest(t, 1, time.Millisecond, time.Millisecond)
- stable := ReleaseInfo{TagName: "v6.4.5", PublishedAt: time.Date(2026, 9, 30, 8, 0, 0, 0, time.UTC)}
- preview := ReleaseInfo{TagName: "v6.4.6-rc.1", Prerelease: true, PublishedAt: time.Date(2026, 10, 2, 8, 0, 0, 0, time.UTC)}
+ // The check only offers an update when the exact server archive exists.
+ stable := ReleaseInfo{TagName: "v6.4.5", PublishedAt: time.Date(2026, 9, 30, 8, 0, 0, 0, time.UTC), Assets: []ReleaseAsset{runtimeArchiveFixture(t, "v6.4.5")}}
+ preview := ReleaseInfo{TagName: "v6.4.6-rc.1", Prerelease: true, PublishedAt: time.Date(2026, 10, 2, 8, 0, 0, 0, time.UTC), Assets: []ReleaseAsset{runtimeArchiveFixture(t, "v6.4.6-rc.1")}}
for _, tc := range []struct {
name string
diff --git a/internal/updates/manager_check_updates_test.go b/internal/updates/manager_check_updates_test.go
index fa07791e74..c4700710e7 100644
--- a/internal/updates/manager_check_updates_test.go
+++ b/internal/updates/manager_check_updates_test.go
@@ -7,6 +7,7 @@ import (
"net/http"
"net/http/httptest"
"os"
+ "runtime"
"strings"
"sync/atomic"
"testing"
@@ -108,12 +109,7 @@ func TestCheckForUpdatesWithChannel_AvailableUsesCache(t *testing.T) {
Body: "Release notes",
Prerelease: false,
PublishedAt: releaseTime,
- Assets: []ReleaseAsset{
- {
- Name: "pulse-v99.0.0-linux-amd64.tar.gz",
- BrowserDownloadURL: "https://example.com/pulse-v99.0.0-linux-amd64.tar.gz",
- },
- },
+ Assets: []ReleaseAsset{runtimeArchiveFixture(t, "v99.0.0")},
},
}
@@ -193,12 +189,7 @@ func TestCheckForUpdates_Wrapper(t *testing.T) {
Body: "Release notes",
Prerelease: false,
PublishedAt: time.Date(2024, 2, 3, 4, 5, 6, 0, time.UTC),
- Assets: []ReleaseAsset{
- {
- Name: "pulse-v99.1.0-linux-amd64.tar.gz",
- BrowserDownloadURL: "https://example.com/pulse-v99.1.0-linux-amd64.tar.gz",
- },
- },
+ Assets: []ReleaseAsset{runtimeArchiveFixture(t, "v99.1.0")},
},
}
@@ -298,3 +289,16 @@ func TestForcedUpdateCheckDoesNotReturnCachedResultOnRateLimit(t *testing.T) {
t.Fatalf("status=%+v", manager.GetStatus())
}
}
+
+// runtimeArchiveFixture returns the server archive the update check requires
+// for the architecture running the test. The check offers an update only when
+// that exact archive exists, so a hard-coded linux-amd64 fixture made these
+// tests fail on arm64 hosts.
+func runtimeArchiveFixture(t *testing.T, tag string) ReleaseAsset {
+ t.Helper()
+ asset, ok := updateReleaseAssetForRuntime(tag)
+ if !ok {
+ t.Skipf("no Pulse server archive is published for %s", runtime.GOARCH)
+ }
+ return ReleaseAsset{Name: asset.Name, BrowserDownloadURL: "https://example.com/" + asset.Name}
+}