From 2494e27a73b91289eedae009ee590340cb491143 Mon Sep 17 00:00:00 2001 From: Juan Font Date: Thu, 22 Dec 2022 15:24:37 +0000 Subject: [PATCH] Make WaitForTailscaleLogout a Scenario method --- integration/auth_web_flow_test.go | 18 +----------------- integration/scenario.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/integration/auth_web_flow_test.go b/integration/auth_web_flow_test.go index 3682ed1e..4c42dfbb 100644 --- a/integration/auth_web_flow_test.go +++ b/integration/auth_web_flow_test.go @@ -147,7 +147,7 @@ func TestAuthWebFlowLogoutAndRelogin(t *testing.T) { } } - scenario.waitForTailscaleLogout() + scenario.WaitForTailscaleLogout() t.Logf("all clients logged out") @@ -259,22 +259,6 @@ func (s *AuthWebFlowScenario) CreateHeadscaleEnv( return nil } -func (s *AuthWebFlowScenario) waitForTailscaleLogout() { - for _, namespace := range s.namespaces { - for _, client := range namespace.Clients { - namespace.syncWaitGroup.Add(1) - - go func(c TailscaleClient) { - defer namespace.syncWaitGroup.Done() - - // TODO(kradalby): error handle this - _ = c.WaitForLogout() - }(client) - } - namespace.syncWaitGroup.Wait() - } -} - func (s *AuthWebFlowScenario) runTailscaleUp( namespaceStr, loginServer string, ) error { diff --git a/integration/scenario.go b/integration/scenario.go index 4a8ee00f..44b5b1ca 100644 --- a/integration/scenario.go +++ b/integration/scenario.go @@ -469,3 +469,19 @@ func (s *Scenario) ListTailscaleClientsFQDNs(namespaces ...string) ([]string, er return allFQDNs, nil } + +func (s *Scenario) WaitForTailscaleLogout() { + for _, namespace := range s.namespaces { + for _, client := range namespace.Clients { + namespace.syncWaitGroup.Add(1) + + go func(c TailscaleClient) { + defer namespace.syncWaitGroup.Done() + + // TODO(kradalby): error handle this + _ = c.WaitForLogout() + }(client) + } + namespace.syncWaitGroup.Wait() + } +}