MCPcopy
hub / github.com/netdata/netdata / TestOnceConcurrentLogsOnlyOnce

Function TestOnceConcurrentLogsOnlyOnce

src/go/logger/ratelimit_test.go:157–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

155}
156
157func TestOnceConcurrentLogsOnlyOnce(t *testing.T) {
158 setTestLevel(t, slog.LevelDebug)
159
160 l, h := newTestLogger(slog.LevelDebug)
161 var wg sync.WaitGroup
162 for range 100 {
163 wg.Go(func() {
164 l.Once("concurrent").Info("x")
165 })
166 }
167 wg.Wait()
168
169 assert.Equal(t, 1, h.count())
170}
171
172func TestRateLimitNilLoggerDoesNotPanic(t *testing.T) {
173 setTestLevel(t, slog.LevelDebug)

Callers

nothing calls this directly

Calls 7

setTestLevelFunction · 0.85
newTestLoggerFunction · 0.85
OnceMethod · 0.80
EqualMethod · 0.80
countMethod · 0.80
InfoMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…