@@ -56,7 +56,7 @@ func TestAllow(t *testing.T) {
56
56
assert .InDelta (t , res .ResetAfter , 999 * time .Millisecond , float64 (10 * time .Millisecond ))
57
57
}
58
58
59
- func TestAllowAtMostN (t * testing.T ) {
59
+ func TestAllowAtMost (t * testing.T ) {
60
60
ctx := context .Background ()
61
61
62
62
l := rateLimiter ()
@@ -69,7 +69,7 @@ func TestAllowAtMostN(t *testing.T) {
69
69
assert .Equal (t , res .RetryAfter , time .Duration (- 1 ))
70
70
assert .InDelta (t , res .ResetAfter , 100 * time .Millisecond , float64 (10 * time .Millisecond ))
71
71
72
- res , err = l .AllowAtMostN (ctx , "test_id" , limit , 2 )
72
+ res , err = l .AllowAtMost (ctx , "test_id" , limit , 2 )
73
73
assert .Nil (t , err )
74
74
assert .Equal (t , res .Allowed , 2 )
75
75
assert .Equal (t , res .Remaining , 7 )
@@ -83,7 +83,7 @@ func TestAllowAtMostN(t *testing.T) {
83
83
assert .Equal (t , res .RetryAfter , time .Duration (- 1 ))
84
84
assert .InDelta (t , res .ResetAfter , 300 * time .Millisecond , float64 (10 * time .Millisecond ))
85
85
86
- res , err = l .AllowAtMostN (ctx , "test_id" , limit , 10 )
86
+ res , err = l .AllowAtMost (ctx , "test_id" , limit , 10 )
87
87
assert .Nil (t , err )
88
88
assert .Equal (t , res .Allowed , 7 )
89
89
assert .Equal (t , res .Remaining , 0 )
@@ -97,7 +97,7 @@ func TestAllowAtMostN(t *testing.T) {
97
97
assert .Equal (t , res .RetryAfter , time .Duration (- 1 ))
98
98
assert .InDelta (t , res .ResetAfter , 999 * time .Millisecond , float64 (10 * time .Millisecond ))
99
99
100
- res , err = l .AllowAtMostN (ctx , "test_id" , limit , 1000 )
100
+ res , err = l .AllowAtMost (ctx , "test_id" , limit , 1000 )
101
101
assert .Nil (t , err )
102
102
assert .Equal (t , res .Allowed , 0 )
103
103
assert .Equal (t , res .Remaining , 0 )
@@ -132,7 +132,7 @@ func BenchmarkAllow(b *testing.B) {
132
132
})
133
133
}
134
134
135
- func BenchmarkAllowAtMostN (b * testing.B ) {
135
+ func BenchmarkAllowAtMost (b * testing.B ) {
136
136
ctx := context .Background ()
137
137
l := rateLimiter ()
138
138
limit := redis_rate .PerSecond (1e6 )
@@ -141,7 +141,7 @@ func BenchmarkAllowAtMostN(b *testing.B) {
141
141
142
142
b .RunParallel (func (pb * testing.PB ) {
143
143
for pb .Next () {
144
- res , err := l .AllowAtMostN (ctx , "foo" , limit , 1 )
144
+ res , err := l .AllowAtMost (ctx , "foo" , limit , 1 )
145
145
if err != nil {
146
146
b .Fatal (err )
147
147
}
0 commit comments