From 9836b097a44f8f62ba05bddf872b1de398e7d851 Mon Sep 17 00:00:00 2001 From: Juan Font Date: Wed, 12 Apr 2023 09:25:51 +0200 Subject: [PATCH] Make sure all clients of a user are ready (#1335) --- integration/auth_oidc_test.go | 9 +++++++++ integration/auth_web_flow_test.go | 9 +++++++++ integration/scenario.go | 9 +++++++++ integration/tsic/tsic.go | 9 +++++++++ 4 files changed, 36 insertions(+) diff --git a/integration/auth_oidc_test.go b/integration/auth_oidc_test.go index 2b3dbdd9..3e61c197 100644 --- a/integration/auth_oidc_test.go +++ b/integration/auth_oidc_test.go @@ -362,6 +362,15 @@ func (s *AuthOIDCScenario) runTailscaleUp( user.joinWaitGroup.Wait() + for _, client := range user.Clients { + err := client.WaitForReady() + if err != nil { + log.Printf("client %s was not ready: %s", client.Hostname(), err) + + return fmt.Errorf("failed to up tailscale node: %w", err) + } + } + return nil } diff --git a/integration/auth_web_flow_test.go b/integration/auth_web_flow_test.go index d06a3d29..7e497f68 100644 --- a/integration/auth_web_flow_test.go +++ b/integration/auth_web_flow_test.go @@ -274,6 +274,15 @@ func (s *AuthWebFlowScenario) runTailscaleUp( } user.joinWaitGroup.Wait() + for _, client := range user.Clients { + err := client.WaitForReady() + if err != nil { + log.Printf("client %s was not ready: %s", client.Hostname(), err) + + return fmt.Errorf("failed to up tailscale node: %w", err) + } + } + return nil } diff --git a/integration/scenario.go b/integration/scenario.go index 29fccf63..7efd08b0 100644 --- a/integration/scenario.go +++ b/integration/scenario.go @@ -356,6 +356,15 @@ func (s *Scenario) RunTailscaleUp( user.joinWaitGroup.Wait() + for _, client := range user.Clients { + err := client.WaitForReady() + if err != nil { + log.Printf("client %s was not ready: %s", client.Hostname(), err) + + return fmt.Errorf("failed to up tailscale node: %w", err) + } + } + return nil } diff --git a/integration/tsic/tsic.go b/integration/tsic/tsic.go index 907bd0d1..efb9ef95 100644 --- a/integration/tsic/tsic.go +++ b/integration/tsic/tsic.go @@ -430,6 +430,15 @@ func (t *TailscaleInContainer) WaitForReady() error { return nil } + // ipnstate.Status.CurrentTailnet was added in Tailscale 1.22.0 + // https://github.com/tailscale/tailscale/pull/3865 + // + // Before that, we can check the BackendState to see if the + // tailscaled daemon is connected to the control system. + if status.BackendState == "Running" { + return nil + } + return errTailscaleNotConnected }) }