spark-server/internal/pkg/ratelimit/ratelimit_test.go
zhr ae9a71034d feat: implement Spark IM V3 modular monolith
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>
2026-09-17 19:52:11 +08:00

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")
}
}