MCPcopy
hub / github.com/netdata/netdata / TestResetAllOnceDoesNotResetLimitState

Function TestResetAllOnceDoesNotResetLimitState

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

Source from the content-addressed store, hash-verified

68}
69
70func TestResetAllOnceDoesNotResetLimitState(t *testing.T) {
71 setTestLevel(t, slog.LevelDebug)
72
73 l, h := newTestLogger(slog.LevelDebug)
74 now := time.Unix(300, 0)
75 l.rl.now = func() time.Time { return now }
76
77 l.Once("k").Info("once-1")
78 l.Limit("k", 1, time.Hour).Info("limit-1")
79 l.Once("k").Info("once-2-suppressed")
80 l.Limit("k", 1, time.Hour).Info("limit-2-suppressed")
81
82 assert.Equal(t, 2, h.count())
83
84 l.ResetAllOnce()
85
86 l.Once("k").Info("once-3")
87 l.Limit("k", 1, time.Hour).Info("limit-3-still-suppressed")
88
89 assert.Equal(t, 3, h.count())
90 assert.Equal(t, "once-3", h.last().msg)
91}
92
93func TestModeNamespacesAndFirstWriterWinsParams(t *testing.T) {
94 setTestLevel(t, slog.LevelDebug)

Callers

nothing calls this directly

Calls 9

setTestLevelFunction · 0.85
newTestLoggerFunction · 0.85
OnceMethod · 0.80
LimitMethod · 0.80
EqualMethod · 0.80
countMethod · 0.80
ResetAllOnceMethod · 0.80
lastMethod · 0.80
InfoMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…