From bc2163777f617cf58494bb4845db41f732b57904 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sun, 3 Jun 2018 10:55:47 +0800 Subject: [PATCH] properly initialise the random number generator in the integration tests --- integrationtests/gquic/gquic_suite_test.go | 4 ++-- integrationtests/gquic/random_rtt_test.go | 2 -- integrationtests/self/self_suite_test.go | 9 +++++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/integrationtests/gquic/gquic_suite_test.go b/integrationtests/gquic/gquic_suite_test.go index 28c8537c6..f8183fddf 100644 --- a/integrationtests/gquic/gquic_suite_test.go +++ b/integrationtests/gquic/gquic_suite_test.go @@ -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() { diff --git a/integrationtests/gquic/random_rtt_test.go b/integrationtests/gquic/random_rtt_test.go index 6041aed6e..f51aa8d1f 100644 --- a/integrationtests/gquic/random_rtt_test.go +++ b/integrationtests/gquic/random_rtt_test.go @@ -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(), diff --git a/integrationtests/self/self_suite_test.go b/integrationtests/self/self_suite_test.go index dce74e177..dd607a843 100644 --- a/integrationtests/self/self_suite_test.go +++ b/integrationtests/self/self_suite_test.go @@ -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()) +})