23 lines
398 B
Go
23 lines
398 B
Go
package message
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestAllowRequestBurstAndAckExemptBucket(t *testing.T) {
|
|
t.Parallel()
|
|
lim := defaultTestLimits()
|
|
lim.RequestsPerSecond = 50
|
|
lim.RequestBurst = 100
|
|
app, _ := openTestApp(t, lim)
|
|
allowed := 0
|
|
for i := 0; i < 150; i++ {
|
|
if app.AllowRequest("alice") {
|
|
allowed++
|
|
}
|
|
}
|
|
if allowed != 100 {
|
|
t.Fatalf("allowed=%d want 100 (burst)", allowed)
|
|
}
|
|
}
|