Skip to content

Commit

Permalink
test/connectivity: Add a bit more logging around Hubble connections
Browse files Browse the repository at this point in the history
When connections to hubble fail, there currently isn't enough
information to debug the issue after-the-fact. So, add in a few more
debug lines to try and get to the bottom of the problem.

Also, bump the connection timeout from 10 to 30 seconds.

Signed-off-by: Casey Callendrello <[email protected]>
  • Loading branch information
squeed committed Nov 9, 2022
1 parent 5ccea19 commit 1ca8202
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions connectivity/check/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,28 @@ func (a *Action) Run(f func(*Action)) {
// Channel for the flow listener to notify us when ready.
ready := make(chan bool, 1)

wg := sync.WaitGroup{}
wg.Add(1)
// TODO(timo): Use an actual context that can be cancelled by the user.
// `Run()` should take context.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
defer func() {
cancel()
wg.Wait()
}()

// Start flow listener in the background.
go func() {
if err := a.followFlows(ctx, ready); err != nil {
a.Fatalf("Receiving flows from Hubble Relay: %s", err)
}
a.Debug("Receiving flows from Hubble Relay gracefully closed down.")
wg.Done()
}()

// Wait for at least one Hubble node to signal that it's ready so we don't
// generate any traffic before it can be captured.
timeout := time.NewTimer(10 * time.Second)
timeout := time.NewTimer(30 * time.Second)
defer timeout.Stop()

select {
Expand Down Expand Up @@ -717,11 +724,13 @@ func (a *Action) followFlows(ctx context.Context, ready chan bool) error {
if errors.Is(err, io.EOF) ||
errors.Is(err, context.Canceled) ||
errors.Is(err, context.DeadlineExceeded) {
a.Debugf("Hubble polling ended: %v", err)
return nil
}

// Return gracefully on 'canceled' gRPC error.
if status.Code(err) == codes.Canceled {
a.Debugf("Hubble polling ended: %v", err)
return nil
}

Expand Down

0 comments on commit 1ca8202

Please sign in to comment.