Skip to content

Commit

Permalink
fix for watch-ipn
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Feb 9, 2024
1 parent 4986ca2 commit bb3f858
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions integration/tsic/tsic.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ func (t *TailscaleInContainer) Netmap() (*netmap.NetworkMap, error) {
// watch-ipn will only give an update if something is happening,
// since we send keep alives, the worst case for this should be
// 1 minute, but set a slightly more conservative time.
ctx, _ := context.WithTimeout(context.Background(), 2*time.Minute)
ctx, _ := context.WithTimeout(context.Background(), 5*time.Minute)

notify, err := t.watchIPN(ctx)
if err != nil {
Expand Down Expand Up @@ -591,7 +591,12 @@ func (t *TailscaleInContainer) watchIPN(ctx context.Context) (*ipn.Notify, error

go func() {
_, _ = t.container.Exec(
[]string{"tailscale", "debug", "watch-ipn"},
// TODO(kradalby): There are no way to stop this call in go since its
// a long running go func, let it timeout itself.
// In the future, look into picking apart the dockertest exec and
// see if there is a good way to cancel.
// Or maybe send equivalent of ctrl+c to stdin?
[]string{"timeout", "180s", "tailscale", "debug", "watch-ipn"},
dockertest.ExecOptions{
// The interesting output is sent to stdout, so ignore stderr.
StdOut: pw,
Expand Down Expand Up @@ -630,7 +635,6 @@ func (t *TailscaleInContainer) watchIPN(ctx context.Context) (*ipn.Notify, error
}

return result.notify, nil

}
}

Expand Down
2 changes: 1 addition & 1 deletion integration/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func assertClientsState(t *testing.T, clients []TailscaleClient) {
}()
}

wg.Done()
wg.Wait()
}

// assertValidNetmap asserts that the netmap of a client has all
Expand Down

0 comments on commit bb3f858

Please sign in to comment.