MCPcopy
hub / github.com/uber-go/zap / TestSamplerRaces

Function TestSamplerRaces

zapcore/sampler_test.go:251–270  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

249}
250
251func TestSamplerRaces(t *testing.T) {
252 sampler, _ := fakeSampler(DebugLevel, time.Minute, 1, 1000)
253
254 var wg sync.WaitGroup
255 start := make(chan struct{})
256
257 for i := 0; i < 100; i++ {
258 wg.Add(1)
259 go func() {
260 <-start
261 for j := 0; j < 100; j++ {
262 writeSequence(sampler, j, InfoLevel)
263 }
264 wg.Done()
265 }()
266 }
267
268 close(start)
269 wg.Wait()
270}
271
272func TestSamplerUnknownLevels(t *testing.T) {
273 // Prove that out-of-bounds levels don't panic.

Callers

nothing calls this directly

Calls 3

fakeSamplerFunction · 0.85
writeSequenceFunction · 0.85
AddMethod · 0.45

Tested by

no test coverage detected