ipn/ipnlocal: fix TestOnTailnetDefaultAutoUpdate on macOS (#15697)

https://github.com/tailscale/tailscale/pull/15395 changed the logic to
skip `EditPrefs` when the platform doesn't support auto-updates. But the
old logic would only fail `EditPrefs` if the auto-update value was
`true`. If it was `false`, `EditPrefs` would succeed and store `false`
in prefs. The new logic will keep the value `unset` even if the tailnet
default is `false`.

Fixes #15691

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
Andrew Lytvynov 2025-04-15 14:01:53 -07:00 committed by GitHub
parent e6eba4efee
commit 34b97a3c75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,7 +15,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
"runtime"
"slices" "slices"
"strings" "strings"
"sync" "sync"
@ -2597,9 +2596,6 @@ func TestPreferencePolicyInfo(t *testing.T) {
} }
func TestOnTailnetDefaultAutoUpdate(t *testing.T) { func TestOnTailnetDefaultAutoUpdate(t *testing.T) {
if runtime.GOOS == "darwin" {
t.Skip("test known broken on macOS; see https://github.com/tailscale/tailscale/issues/15691")
}
tests := []struct { tests := []struct {
before, after opt.Bool before, after opt.Bool
container opt.Bool container opt.Bool
@ -2669,7 +2665,7 @@ func TestOnTailnetDefaultAutoUpdate(t *testing.T) {
// On platforms that don't support auto-update we can never // On platforms that don't support auto-update we can never
// transition to auto-updates being enabled. The value should // transition to auto-updates being enabled. The value should
// remain unchanged after onTailnetDefaultAutoUpdate. // remain unchanged after onTailnetDefaultAutoUpdate.
if !clientupdate.CanAutoUpdate() && want.EqualBool(true) { if !clientupdate.CanAutoUpdate() {
want = tt.before want = tt.before
} }
if got := b.pm.CurrentPrefs().AutoUpdate().Apply; got != want { if got := b.pm.CurrentPrefs().AutoUpdate().Apply; got != want {