mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-25 08:41:00 +00:00
fix flaky test gosched hack
Signed-off-by: Sandro Jijavadze <sandrojijavadze@protonmail.com>
This commit is contained in:
parent
d90c8ff92d
commit
2ab624a917
1 changed files with 9 additions and 0 deletions
|
@ -15,6 +15,7 @@ package relay
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -68,6 +69,14 @@ func TestRelay_RelayLine(t *testing.T) {
|
|||
for _, line := range tt.args.lines {
|
||||
r.RelayLine(line)
|
||||
}
|
||||
|
||||
for goSchedTimes := 0; goSchedTimes < 1000; goSchedTimes++ {
|
||||
if len(r.bufferChannel) == 0 {
|
||||
break
|
||||
}
|
||||
runtime.Gosched()
|
||||
}
|
||||
|
||||
// Tick time forward to trigger a packet send.
|
||||
clock.ClockInstance.Instant = time.Unix(1, 10)
|
||||
clock.ClockInstance.TickerCh <- time.Unix(0, 0)
|
||||
|
|
Loading…
Reference in a new issue