mirror of https://github.com/k3s-io/k3s
Seed math/rand in TestMain before tests are executed
parent
f5e9c0473c
commit
55bc668f8d
|
@ -74,6 +74,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
pflag.Parse()
|
pflag.Parse()
|
||||||
framework.AfterReadingAllFlags(&framework.TestContext)
|
framework.AfterReadingAllFlags(&framework.TestContext)
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
|
@ -119,7 +120,6 @@ func TestE2eNode(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// If run-services-mode is not specified, run test.
|
// If run-services-mode is not specified, run test.
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
RegisterFailHandler(Fail)
|
RegisterFailHandler(Fail)
|
||||||
reporters := []Reporter{}
|
reporters := []Reporter{}
|
||||||
reportDir := framework.TestContext.ReportDir
|
reportDir := framework.TestContext.ReportDir
|
||||||
|
|
|
@ -17,11 +17,14 @@ limitations under the License.
|
||||||
package volume
|
package volume
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"k8s.io/kubernetes/test/integration/framework"
|
"k8s.io/kubernetes/test/integration/framework"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
framework.EtcdMain(m.Run)
|
framework.EtcdMain(m.Run)
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,6 @@ func TestPersistentVolumeBindRace(t *testing.T) {
|
||||||
glog.V(2).Infof("TestPersistentVolumeBindRace claims created")
|
glog.V(2).Infof("TestPersistentVolumeBindRace claims created")
|
||||||
|
|
||||||
// putting a bind manually on a pv should only match the claim it is bound to
|
// putting a bind manually on a pv should only match the claim it is bound to
|
||||||
rand.Seed(time.Now().Unix())
|
|
||||||
claim := claims[rand.Intn(maxClaims-1)]
|
claim := claims[rand.Intn(maxClaims-1)]
|
||||||
claimRef, err := ref.GetReference(legacyscheme.Scheme, claim)
|
claimRef, err := ref.GetReference(legacyscheme.Scheme, claim)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue