mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-03 04:38:48 +00:00
Give update check test fixtures the exact runtime archive (#2297)
TestCheckForUpdatesWithChannel_AvailableUsesCache and TestCheckForUpdates_Wrapper hard-code a linux-amd64 archive, and sinceab0aa1ef0the update check only offers an update when the exact archive for the host architecture exists. CI runs on amd64 so it's green, but both fail on arm64 machines. The fixtures now build the archive name from the same runtime helper the updater uses. Test only. This first went up to also fix the rest-1 failure from the #2286 test, but3a362f0affixed that on main in the meantime, so I merged main and kept its version. The internal/updates suite passes here on arm64 and on amd64 through Rosetta. The v6.4 counterpart is #2296.
This commit is contained in:
commit
5b3a47e305
1 changed files with 16 additions and 12 deletions
|
|
@ -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}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue