Skip to content

Commit

Permalink
Fix packetbeat flaky tests (elastic#5200)
Browse files Browse the repository at this point in the history
Moved the shutdown timeout after stopping the flows, but before stopping
the transaction publishing. It needs to be after stopping the flows because
the tests rely on the shutdown sequence to create flow reports.

(cherry picked from commit c0de062)
  • Loading branch information
tsg committed Nov 15, 2017
1 parent c03de15 commit b0b1e44
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packetbeat/beater/packetbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ func (pb *packetbeat) Run(b *beat.Beat) error {
}()

defer pb.transPub.Stop()

timeout := pb.config.ShutdownTimeout
if timeout > 0 {
defer time.Sleep(timeout)
}

if pb.flows != nil {
pb.flows.Start()
defer pb.flows.Stop()
Expand Down Expand Up @@ -204,11 +210,6 @@ func (pb *packetbeat) Run(b *beat.Beat) error {
return err
}

timeout := pb.config.ShutdownTimeout
if timeout > 0 {
time.Sleep(timeout)
}

return nil
}

Expand Down

0 comments on commit b0b1e44

Please sign in to comment.