ooni-probe-cli/internal/engine/netx/tracex/saver_test.go

25 lines
364 B
Go
Raw Normal View History

package tracex
import (
"sync"
"testing"
)
func TestGood(t *testing.T) {
saver := Saver{}
var wg sync.WaitGroup
const parallel = 10
wg.Add(parallel)
for idx := 0; idx < parallel; idx++ {
go func() {
saver.Write(Event{})
wg.Done()
}()
}
wg.Wait()
ev := saver.Read()
if len(ev) != parallel {
t.Fatal("unexpected number of events read")
}
}