properly initialise the random number generator in the integration tests

This commit is contained in:
Marten Seemann
2018-06-03 10:55:47 +08:00
parent 1fc6c5a14c
commit bc2163777f
3 changed files with 9 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ package gquic_test
import (
"fmt"
mrand "math/rand"
"math/rand"
"path/filepath"
"runtime"
@@ -26,7 +26,7 @@ func TestIntegration(t *testing.T) {
}
var _ = BeforeSuite(func() {
mrand.Seed(GinkgoRandomSeed())
rand.Seed(GinkgoRandomSeed())
})
var _ = JustBeforeEach(func() {

View File

@@ -24,7 +24,6 @@ func getRandomDuration(min, max time.Duration) time.Duration {
}
var _ = Describe("Random Duration Generator", func() {
rand.Seed(time.Now().UnixNano())
It("gets a random RTT", func() {
var min time.Duration = time.Hour
var max time.Duration
@@ -54,7 +53,6 @@ var _ = Describe("Random RTT", func() {
var proxy *quicproxy.QuicProxy
runRTTTest := func(minRtt, maxRtt time.Duration, version protocol.VersionNumber) {
rand.Seed(time.Now().UnixNano())
var err error
proxy, err = quicproxy.NewQuicProxy("localhost:", version, &quicproxy.Opts{
RemoteAddr: "localhost:" + testserver.Port(),

View File

@@ -1,15 +1,20 @@
package self_test
import (
"math/rand"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "github.com/lucas-clemente/quic-go/integrationtests/tools/testlog"
"testing"
)
func TestSelf(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Self integration tests")
}
var _ = BeforeSuite(func() {
rand.Seed(GinkgoRandomSeed())
})