A release comes every few minutes, so a downloaded update was always
waiting and the pill (window and tray panel) never went out. /api/update
now says "quiet" while this version has been behind for less than 3 days
(update.Quiet, the Stable channel's soak; counted from the first newer
version seen, kept in update-behind.json for the version running), and the
pill stays away. An urgent release ("**Urgent release:**" in the latest's
notes or any release between, fetched once per check) lights it at once and
a dismissal does not hide it. The x dismissal now also starts the quiet over,
so the pill is not back with the next release. Settings > Version, the tray's
Restart to update, quit and Restart automatically are unchanged. Plugins'
dot is for plugins that do not update by themselves; left alone.
Run (mote): go test ./internal/update (ok), go test -run Update|Asset|Budget|Script ./internal/gui (ok),
gofmt, go vet darwin / linux nogui / windows clean, update-quiet.test.cjs 21/21 in chromium and
webkit across en, zh, zh-TW, ja, de, panel and window. Broken by hand: dropping
!u.quiet in app.js (11 red), forcing Quiet=false in jsonIn (TestUpdateQuietUntilBehindAWhile red).
Not tried: a real 3-day wait, and the urgent range lookup against the live site.
31 lines
893 B
Go
31 lines
893 B
Go
package gui
|
|
|
|
import (
|
|
"net"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/yetone/magpie/internal/fx"
|
|
"github.com/yetone/magpie/internal/testenv"
|
|
)
|
|
|
|
// TestMain keeps the rate off the network: a state read with no rate cached
|
|
// asks for one behind it (#541), which would otherwise reach the real
|
|
// endpoint and land in whatever test runs next. And the tests run in a
|
|
// home of their own, never the user's real files.
|
|
func TestMain(m *testing.M) {
|
|
// started by TestGatewayFixQuitsOnlyAMagpie as an older magpie
|
|
if addr := os.Getenv("MAGPIE_TEST_FAKE_GATEWAY"); addr != "" {
|
|
fakeOlderGateway(addr)
|
|
return
|
|
}
|
|
l, err := net.Listen("tcp", "127.0.0.1:0")
|
|
if err == nil {
|
|
addr := l.Addr().String()
|
|
l.Close() // refused at once from here on
|
|
fx.SetRateURL("http://" + addr + "/")
|
|
os.Setenv("MAGPIE_NOTES_FEED", "http://"+addr+"/") // no test asks the site for notes
|
|
}
|
|
os.Exit(testenv.Run(m))
|
|
}
|