Add HTTP /v1 MVC, TCP send path, groups with server-side member-avatar collage, object-storage upload, and friends/favorites around the architecture-v3 layout. Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
317 B
Go
20 lines
317 B
Go
package ratelimit
|
|
|
|
import "testing"
|
|
|
|
func TestAllowBurstThenBlock(t *testing.T) {
|
|
l := New(2)
|
|
if !l.Allow("203.0.113.10") {
|
|
t.Fatal("first")
|
|
}
|
|
if !l.Allow("203.0.113.10") {
|
|
t.Fatal("burst")
|
|
}
|
|
if l.Allow("203.0.113.10") {
|
|
t.Fatal("over burst")
|
|
}
|
|
if !l.Allow("198.51.100.20") {
|
|
t.Fatal("other ip")
|
|
}
|
|
}
|