Skip to content

Commit

Permalink
Make WaitForTailscaleLogout a Scenario method
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfont committed Dec 22, 2022
1 parent 8e8b65b commit 2494e27
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 1 addition & 17 deletions integration/auth_web_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func TestAuthWebFlowLogoutAndRelogin(t *testing.T) {
}
}

scenario.waitForTailscaleLogout()
scenario.WaitForTailscaleLogout()

t.Logf("all clients logged out")

Expand Down Expand Up @@ -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 {
Expand Down
16 changes: 16 additions & 0 deletions integration/scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

0 comments on commit 2494e27

Please sign in to comment.