Add integration tests that check logout and relogin

This commit is contained in:
Juan Font 2022-12-19 18:15:31 +00:00
parent 593040b73d
commit b54c0e3d22
3 changed files with 180 additions and 2 deletions

View file

@ -30,6 +30,7 @@ var (
errTailscaleWrongPeerCount = errors.New("wrong peer count")
errTailscaleCannotUpWithoutAuthkey = errors.New("cannot up without authkey")
errTailscaleNotConnected = errors.New("tailscale not connected")
errTailscaleNotLoggedOut = errors.New("tailscale not logged out")
)
type TailscaleInContainer struct {
@ -350,6 +351,21 @@ func (t *TailscaleInContainer) WaitForReady() error {
})
}
func (t *TailscaleInContainer) WaitForLogout() error {
return t.pool.Retry(func() error {
status, err := t.Status()
if err != nil {
return fmt.Errorf("failed to fetch tailscale status: %w", err)
}
if status.CurrentTailnet == nil {
return nil
}
return errTailscaleNotLoggedOut
})
}
func (t *TailscaleInContainer) WaitForPeers(expected int) error {
return t.pool.Retry(func() error {
status, err := t.Status()