Remove Saturation() from rate limiter interface

Kubernetes-commit: a9ed90f227f07fab2da75541d57a5366ddb38f66
This commit is contained in:
Jordan Liggitt
2018-01-19 01:59:33 -05:00
committed by Kubernetes Publisher
parent 847d15469a
commit 7392f7f78f
2 changed files with 0 additions and 43 deletions

View File

@@ -17,7 +17,6 @@ limitations under the License.
package flowcontrol
import (
"math"
"sync"
"testing"
"time"
@@ -116,29 +115,6 @@ func TestThrottle(t *testing.T) {
}
}
func TestRateLimiterSaturation(t *testing.T) {
const e = 0.000001
tests := []struct {
capacity int
take int
expectedSaturation float64
}{
{1, 1, 1},
{10, 3, 0.3},
}
for i, tt := range tests {
rl := NewTokenBucketRateLimiter(1, tt.capacity)
for i := 0; i < tt.take; i++ {
rl.Accept()
}
if math.Abs(rl.Saturation()-tt.expectedSaturation) > e {
t.Fatalf("#%d: Saturation rate difference isn't within tolerable range\n want=%f, get=%f",
i, tt.expectedSaturation, rl.Saturation())
}
}
}
func TestAlwaysFake(t *testing.T) {
rl := NewFakeAlwaysRateLimiter()
if !rl.TryAccept() {