realfxw on X (tweet 2123033167170814171): "升级无效,重启了无数次,一直卡在这个版本", on 0.1.4445. Every release around it has its 17 assets, so nothing was missing to download. Their Update channel is Daily, and Daily's pick (the 11-17 20:00 UTC cut) is 0.1.4395, older than what they run. The app keeps the newer version and installs nothing until Daily passes it, which is right, but the version row said "Up to date on Daily" (每日版已是最新) and, before a check, Automatic updates are off with a bare Restart. They restarted again and again waiting for an update that couldn't come. - update.go: the update JSON says ahead when the state is latest and this version is newer than the channel's. - app.js: the row says "Newer than Daily's 0.1.4395; it updates once Daily passes it", the newest on Every version after it, and Switch to Every version as before; one t() for both channels and the Every version tail shared with Up to date. Translated in zh, zh-TW, ja, de. - update_cli.go: `magpie update check` says the same, with `magpie update channel every` to get it now. - core_budget_test.go: +68 bytes of code on app.js and the core scripts, packed to the shortest form; renderUpdate draws on every window, so there is no page to move it to. - docs/reference.md: the channel section names Daily and the line. Red on the old code (upd-ahead-red, origin/mainb855cfee9): TestUpdateAheadOfChannel FAIL (no ahead key in the JSON), TestUpdateAheadOfChannelSaysSo FAIL ("up to date"), and update-stable-newest.test.cjs timed out on the ahead line in every language. Run at this head (253547908's tree, rebased on4d79bebfa), on mote: - gofmt -l clean; go vet ./internal/gui ./internal/cli ./internal/update for darwin, GOOS=linux -tags nogui and GOOS=windows; go build . for all three. - go test -count=1 ./internal/gui ./internal/cli ./internal/update ./internal/settings: update and settings ok; the new tests pass; gui and cli red only on TestLaneLimitRoutes (#5150), TestHealthcheckFindsTheRunningGatewayWithoutMagpieAddr, TestUpdateRestartsTheGatewayItFindsWithoutMagpieAddr (#6471) and TestUpdateFindsAMagpieThatWroteNoRecord (#6223), the same on origin/mainb855cfee9on mote, where an ssh forward holds 127.0.0.1:3425. - GUI, BROWSER=chromium and webkit: update-*, i18n-*, gui-zh-tw/ja/de, settings-search(-reach), 28 files, 296/296 each, before the rebase; update-stable-newest and i18n-keys 15/15 each after it, with TestCoreScriptBudget ok. Not run: the full go test ./... suite. mote and mica each had another session's full suite running, and mica's disk is full; CI runs it. Not tried: a real Daily install moving past it.
47 lines
1.6 KiB
Go
47 lines
1.6 KiB
Go
package cli
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/yetone/magpie/internal/settings"
|
|
"github.com/yetone/magpie/internal/update"
|
|
)
|
|
|
|
// `magpie update` on a version newer than its channel's (realfxw on X:
|
|
// 0.1.4445 on Daily, whose pick was 0.1.4395) said it was up to date, and
|
|
// nothing came until Daily passed it. It now says it is newer than the
|
|
// channel's, and how to update now. On the channel's own version it is up
|
|
// to date as before.
|
|
func TestUpdateAheadOfChannelSaysSo(t *testing.T) {
|
|
groupsHome(t)
|
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
v := "0.1.4472"
|
|
if r.URL.Query().Get("channel") == "daily" {
|
|
v = "0.1.4395"
|
|
}
|
|
json.NewEncoder(w).Encode(update.Release{Version: v})
|
|
}))
|
|
defer srv.Close()
|
|
t.Setenv("MAGPIE_UPDATE_FEED", srv.URL)
|
|
if err := settings.Save(settings.Settings{UpdateChannel: settings.UpdateDaily}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
was := version
|
|
t.Cleanup(func() { version = was })
|
|
|
|
version = "0.1.4445"
|
|
out, err := stdoutOf(t, func() error { return updateCmd([]string{"update", "check"}) })
|
|
if err != nil || !strings.Contains(out, "is newer than the daily channel's 0.1.4395") || !strings.Contains(out, "magpie update channel every") || strings.Contains(out, "up to date") {
|
|
t.Fatalf("ahead of daily: %v %q", err, out)
|
|
}
|
|
version = "0.1.4395"
|
|
out, err = stdoutOf(t, func() error { return updateCmd([]string{"update", "check"}) })
|
|
if err != nil || !strings.Contains(out, "is up to date on the daily channel") {
|
|
t.Fatalf("daily's own version: %v %q", err, out)
|
|
}
|
|
}
|