mock: increase tolerance for latency tests
These were exceeding their tolerances when run under the race detector on CI.
This commit is contained in:
parent
5b643cde2d
commit
5c51323aa2
|
@ -489,36 +489,36 @@ func TestAdding(t *testing.T) {
|
||||||
func TestRateLimiting(t *testing.T) {
|
func TestRateLimiting(t *testing.T) {
|
||||||
rl := NewRateLimiter(10)
|
rl := NewRateLimiter(10)
|
||||||
|
|
||||||
if !within(rl.Limit(10), time.Duration(float32(time.Second)), time.Millisecond/10) {
|
if !within(rl.Limit(10), time.Duration(float32(time.Second)), time.Millisecond) {
|
||||||
t.Fail()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
if !within(rl.Limit(10), time.Duration(float32(time.Second*2)), time.Millisecond) {
|
if !within(rl.Limit(10), time.Duration(float32(time.Second*2)), time.Millisecond) {
|
||||||
t.Fail()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
if !within(rl.Limit(10), time.Duration(float32(time.Second*3)), time.Millisecond) {
|
if !within(rl.Limit(10), time.Duration(float32(time.Second*3)), time.Millisecond) {
|
||||||
t.Fail()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
if within(rl.Limit(10), time.Duration(float32(time.Second*3)), time.Millisecond) {
|
if within(rl.Limit(10), time.Duration(float32(time.Second*3)), time.Millisecond) {
|
||||||
t.Fail()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
rl.UpdateBandwidth(50)
|
rl.UpdateBandwidth(50)
|
||||||
if !within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond/10) {
|
if !within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond) {
|
||||||
t.Fail()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
if within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond/10) {
|
if within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond) {
|
||||||
t.Fail()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
rl.UpdateBandwidth(100)
|
rl.UpdateBandwidth(100)
|
||||||
if !within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond/10) {
|
if !within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond) {
|
||||||
t.Fail()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
if within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond/10) {
|
if within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond) {
|
||||||
t.Fail()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue