mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/logger: removed broken test after 746ee191e8
This commit is contained in:
parent
132425eb46
commit
4c13bae1cf
1 changed files with 0 additions and 40 deletions
|
@ -1,40 +0,0 @@
|
|||
package logger
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestLoggerWithThrottler(t *testing.T) {
|
||||
lName := "test"
|
||||
lThrottle := 50 * time.Millisecond
|
||||
|
||||
lt := WithThrottler(lName, lThrottle)
|
||||
var i int
|
||||
lt.warnF = func(format string, args ...interface{}) {
|
||||
i++
|
||||
}
|
||||
|
||||
lt.Warnf("")
|
||||
lt.Warnf("")
|
||||
lt.Warnf("")
|
||||
|
||||
if i != 1 {
|
||||
t.Fatalf("expected logger will be throttled to 1; got %d instead", i)
|
||||
}
|
||||
|
||||
time.Sleep(lThrottle * 2) // wait to throttle to fade off
|
||||
// the same logger supposed to be return for the same name
|
||||
WithThrottler(lName, lThrottle).Warnf("")
|
||||
if i != 2 {
|
||||
t.Fatalf("expected logger to have 2 iterations; got %d instead", i)
|
||||
}
|
||||
|
||||
logThrottlerRegistryMu.Lock()
|
||||
registeredN := len(logThrottlerRegistry)
|
||||
logThrottlerRegistryMu.Unlock()
|
||||
|
||||
if registeredN != 1 {
|
||||
t.Fatalf("expected only 1 logger to be registered; got %d", registeredN)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue