From 7ba8f0393670bd9006f56dabea162cfc0f6d0309 Mon Sep 17 00:00:00 2001 From: Andrew Lytvynov Date: Mon, 29 Apr 2024 13:35:29 -0700 Subject: [PATCH] ipn/ipnlocal: fix TestOnTailnetDefaultAutoUpdate on unsupported platforms (#11921) Fixes #11894 Signed-off-by: Andrew Lytvynov --- ipn/ipnlocal/local_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ipn/ipnlocal/local_test.go b/ipn/ipnlocal/local_test.go index 61efc2fb0..88373106a 100644 --- a/ipn/ipnlocal/local_test.go +++ b/ipn/ipnlocal/local_test.go @@ -15,7 +15,6 @@ import ( "net/netip" "os" "reflect" - "runtime" "slices" "sync" "testing" @@ -2283,9 +2282,6 @@ func TestPreferencePolicyInfo(t *testing.T) { } func TestOnTailnetDefaultAutoUpdate(t *testing.T) { - if runtime.GOOS == "darwin" { - t.Skip("test broken on macOS; see https://github.com/tailscale/tailscale/issues/11894") - } tests := []struct { before, after opt.Bool tailnetDefault bool @@ -2330,7 +2326,14 @@ func TestOnTailnetDefaultAutoUpdate(t *testing.T) { t.Fatal(err) } b.onTailnetDefaultAutoUpdate(tt.tailnetDefault) - if want, got := tt.after, b.pm.CurrentPrefs().AutoUpdate().Apply; got != want { + want := tt.after + // On platforms that don't support auto-update we can never + // transition to auto-updates being enabled. The value should + // remain unchanged after onTailnetDefaultAutoUpdate. + if !clientupdate.CanAutoUpdate() && want.EqualBool(true) { + want = tt.before + } + if got := b.pm.CurrentPrefs().AutoUpdate().Apply; got != want { t.Errorf("got: %q, want %q", got, want) } })