mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-19 11:57:07 +09:00
integration: expect NeedsLogin after deletion only from 1.106
Older clients keep retrying a map 404, as against Tailscale. Updates #3688
This commit is contained in:
1 parent
2e03bee425
commit
30a31e77cf
2 files changed
+15
-9
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user