mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-28 12:35:21 +00:00
Make WaitForTailscaleLogout a Scenario method
This commit is contained in:
parent
8e8b65bb84
commit
2494e27a73
@ -147,7 +147,7 @@ func TestAuthWebFlowLogoutAndRelogin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scenario.waitForTailscaleLogout()
|
scenario.WaitForTailscaleLogout()
|
||||||
|
|
||||||
t.Logf("all clients logged out")
|
t.Logf("all clients logged out")
|
||||||
|
|
||||||
@ -259,22 +259,6 @@ func (s *AuthWebFlowScenario) CreateHeadscaleEnv(
|
|||||||
return nil
|
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(
|
func (s *AuthWebFlowScenario) runTailscaleUp(
|
||||||
namespaceStr, loginServer string,
|
namespaceStr, loginServer string,
|
||||||
) error {
|
) error {
|
||||||
|
@ -469,3 +469,19 @@ func (s *Scenario) ListTailscaleClientsFQDNs(namespaces ...string) ([]string, er
|
|||||||
|
|
||||||
return allFQDNs, nil
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user