Cleanup math/rand package usage

Kubernetes-commit: 4ce1fb7d40beb9010e56d60792c4da25e8d86ed0
This commit is contained in:
Mikhail Mazurskiy
2018-11-17 16:45:36 +11:00
committed by Kubernetes Publisher
parent e1c806028d
commit c90a87409a
6 changed files with 67 additions and 18 deletions

View File

@@ -19,7 +19,6 @@ package record
import (
"encoding/json"
"fmt"
"math/rand"
"net/http"
"strconv"
"testing"
@@ -417,7 +416,6 @@ func TestWriteEventError(t *testing.T) {
clock := clock.IntervalClock{Time: time.Now(), Duration: time.Second}
eventCorrelator := NewEventCorrelator(&clock)
randGen := rand.New(rand.NewSource(time.Now().UnixNano()))
for caseName, ent := range table {
attempts := 0
@@ -431,7 +429,7 @@ func TestWriteEventError(t *testing.T) {
},
}
ev := &v1.Event{}
recordToSink(sink, ev, eventCorrelator, randGen, 0)
recordToSink(sink, ev, eventCorrelator, 0)
if attempts != ent.attemptsWanted {
t.Errorf("case %v: wanted %d, got %d attempts", caseName, ent.attemptsWanted, attempts)
}
@@ -441,7 +439,6 @@ func TestWriteEventError(t *testing.T) {
func TestUpdateExpiredEvent(t *testing.T) {
clock := clock.IntervalClock{Time: time.Now(), Duration: time.Second}
eventCorrelator := NewEventCorrelator(&clock)
randGen := rand.New(rand.NewSource(time.Now().UnixNano()))
var createdEvent *v1.Event
@@ -462,7 +459,7 @@ func TestUpdateExpiredEvent(t *testing.T) {
ev := &v1.Event{}
ev.ResourceVersion = "updated-resource-version"
ev.Count = 2
recordToSink(sink, ev, eventCorrelator, randGen, 0)
recordToSink(sink, ev, eventCorrelator, 0)
if createdEvent == nil {
t.Error("Event did not get created after patch failed")