@@ -60,18 +60,31 @@ func TestLoggly(t *testing.T) {
60
60
golog .RegisterReporter (r .Report )
61
61
log := golog .LoggerFor ("test" )
62
62
63
- log .Error ("" )
64
- log .Debugf ("**************** %v" , buf .String ())
65
- if assert .NoError (t , json .Unmarshal (buf .Bytes (), & result ), "Unmarshal error" ) {
66
- assert .Regexp (t , "test: logging_test.go:([0-9]+)" , result ["locationInfo" ])
67
- assert .Equal (t , "" , result ["message" ])
63
+ origLogglyRateLimit := logglyRateLimit
64
+ defer func () {
65
+ logglyRateLimit = origLogglyRateLimit
66
+ }()
67
+ logglyRateLimit = 100 * time .Millisecond
68
+ for i := 0 ; i < 2 ; i ++ {
69
+ buf .Reset ()
70
+ log .Error ("short message" )
71
+ if i == 1 {
72
+ assert .Equal (t , 0 , buf .Len (), "duplicate shouldn't have been reported" )
73
+ time .Sleep (logglyRateLimit )
74
+ } else {
75
+ if assert .NoError (t , json .Unmarshal (buf .Bytes (), & result ), "Unmarshal error" ) {
76
+ assert .Regexp (t , "test: logging_test.go:([0-9]+)" , result ["locationInfo" ])
77
+ assert .Equal (t , "short message" , result ["message" ])
78
+ }
79
+ }
68
80
}
69
81
70
82
buf .Reset ()
71
- log .Error ("short message" )
83
+ log .Error ("" )
84
+ log .Debugf ("**************** %v" , buf .String ())
72
85
if assert .NoError (t , json .Unmarshal (buf .Bytes (), & result ), "Unmarshal error" ) {
73
86
assert .Regexp (t , "test: logging_test.go:([0-9]+)" , result ["locationInfo" ])
74
- assert .Equal (t , "short message " , result ["message" ])
87
+ assert .Equal (t , "" , result ["message" ])
75
88
}
76
89
77
90
buf .Reset ()
0 commit comments