From 30a31e77cfb59d2f93db930d74c26d8b3ff64599 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Tue, 10 Nov 2026 14:01:02 +0000 Subject: [PATCH] integration: expect NeedsLogin after deletion only from 1.106 Older clients keep retrying a map 404, as against Tailscale. Updates #3688 --- integration/acl_test.go | 3 --- integration/general_test.go | 21 +++++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/integration/acl_test.go b/integration/acl_test.go index 1c5994c74..6709608bd 100644 --- a/integration/acl_test.go +++ b/integration/acl_test.go @@ -2035,9 +2035,6 @@ func TestACLPolicyPropagationOverTime(t *testing.T) { // This is necessary for WaitForTailscaleSyncPerUser to calculate correct peer counts t.Logf("Iteration %d: Phase 2b - Removing deleted client from scenario", iteration) - // Match on hostname, not on Status().Self.ID: a deleted node is served - // an expired self node carrying no StableID, so Self.ID is empty by the - // time this runs. for clientName, client := range scenario.users["user1"].Clients { if client.Hostname() == nodeToDeleteName { delete(scenario.users["user1"].Clients, clientName) diff --git a/integration/general_test.go b/integration/general_test.go index 03080f290..135d02296 100644 --- a/integration/general_test.go +++ b/integration/general_test.go @@ -22,6 +22,7 @@ import ( "golang.org/x/sync/errgroup" "tailscale.com/client/tailscale/apitype" "tailscale.com/types/key" + "tailscale.com/util/cmpver" "tailscale.com/util/dnsname" ) @@ -1759,12 +1760,17 @@ func TestPingAllByIPManyUpDown(t *testing.T) { } // TestNodeDeletionEndsLongPoll verifies that deleting a node ends its map -// session and tells the client to re-authenticate. Before the fix the deleted -// node's long poll was orphaned: the client stayed Running forever against a -// node that no longer existed, and the server could not shut down while that -// stream was open. +// session without disturbing its peers. Before the fix the deleted node's long +// poll was orphaned: the client stayed Running forever against a node that no +// longer existed, and the server could not shut down while that stream was +// open. +// +// The reconnecting client then gets a bare 404, as from Tailscale's control +// server. Only clients that read a map 404 as removal reach NeedsLogin; older +// ones keep retrying, as they do against Tailscale. // // See: https://github.com/juanfont/headscale/issues/3410 +// See: https://github.com/juanfont/headscale/issues/3688 func TestNodeDeletionEndsLongPoll(t *testing.T) { IntegrationSkip(t) t.Parallel() @@ -1825,8 +1831,11 @@ func TestNodeDeletionEndsLongPoll(t *testing.T) { require.True(t, ok, "node list must contain client %s", deleted.Hostname()) require.NoError(t, headscale.DeleteNode(deletedID)) - require.NoError(t, deleted.WaitForNeedsLogin(integrationutil.StatusReadyTimeout), - "deleted client %s must stop polling and ask for a new login", deleted.Hostname()) + // Clients read a map 404 as removal since 1.106; "unstable" may predate it. + if v := deleted.Version(); v == "head" || (v != "unstable" && cmpver.Compare(v, "1.106") >= 0) { + require.NoError(t, deleted.WaitForNeedsLogin(integrationutil.StatusReadyTimeout), + "deleted client %s must stop polling and ask for a new login", deleted.Hostname()) + } for _, client := range allClients[i+1:] { assert.EventuallyWithT(t, func(ct *assert.CollectT) {