From 9f86e644e1feda001fe0108ffb93f2e43b105f9c Mon Sep 17 00:00:00 2001 From: muXxer Date: Thu, 23 Feb 2023 18:02:09 +0100 Subject: [PATCH] No need to rand.Seed in go 1.20 --- packages/chain/chainMgr/chainMgr_test.go | 3 --- packages/chain/cmtLog/cmtLog_test.go | 3 --- packages/chain/cons/cons_test.go | 3 --- packages/chain/cons/gr/gr_test.go | 2 -- packages/chain/dss/dss_test.go | 3 --- packages/chain/dss/trivial_dkg_test.go | 3 --- packages/chain/mempool/distSync/distSync_test.go | 1 - packages/chain/mempool/mempool_test.go | 3 --- packages/chain/mempool/time_pool_test.go | 2 -- packages/chain/mempool/wait_req_test.go | 3 --- packages/chain/node_test.go | 1 - 11 files changed, 27 deletions(-) diff --git a/packages/chain/chainMgr/chainMgr_test.go b/packages/chain/chainMgr/chainMgr_test.go index b548dd5227..1583ffe844 100644 --- a/packages/chain/chainMgr/chainMgr_test.go +++ b/packages/chain/chainMgr/chainMgr_test.go @@ -5,9 +5,7 @@ package chainMgr_test import ( "fmt" - "math/rand" "testing" - "time" "github.com/stretchr/testify/require" @@ -48,7 +46,6 @@ func TestBasic(t *testing.T) { } func testBasic(t *testing.T, n, f int) { - rand.Seed(time.Now().UnixNano()) log := testlogger.NewLogger(t) defer log.Sync() // diff --git a/packages/chain/cmtLog/cmtLog_test.go b/packages/chain/cmtLog/cmtLog_test.go index d39ee190b7..7a95357ca0 100644 --- a/packages/chain/cmtLog/cmtLog_test.go +++ b/packages/chain/cmtLog/cmtLog_test.go @@ -5,9 +5,7 @@ package cmtLog_test import ( "fmt" - "math/rand" "testing" - "time" "github.com/stretchr/testify/require" @@ -40,7 +38,6 @@ func TestBasic(t *testing.T) { } func testBasic(t *testing.T, n, f int) { - rand.Seed(time.Now().UnixNano()) log := testlogger.NewLogger(t) defer log.Sync() // diff --git a/packages/chain/cons/cons_test.go b/packages/chain/cons/cons_test.go index a6fad76715..58aa3ba052 100644 --- a/packages/chain/cons/cons_test.go +++ b/packages/chain/cons/cons_test.go @@ -6,7 +6,6 @@ package cons_test import ( "context" "fmt" - "math/rand" "sync" "sync/atomic" "testing" @@ -65,7 +64,6 @@ func TestBasic(t *testing.T) { func testBasic(t *testing.T, n, f int) { t.Parallel() - rand.Seed(time.Now().UnixNano()) log := testlogger.NewLogger(t) defer log.Sync() // @@ -295,7 +293,6 @@ func TestChained(t *testing.T) { func testChained(t *testing.T, n, f, b int) { t.Parallel() - rand.Seed(time.Now().UnixNano()) log := testlogger.NewLogger(t) defer log.Sync() // diff --git a/packages/chain/cons/gr/gr_test.go b/packages/chain/cons/gr/gr_test.go index 90e8983182..70afe72e18 100644 --- a/packages/chain/cons/gr/gr_test.go +++ b/packages/chain/cons/gr/gr_test.go @@ -6,7 +6,6 @@ package consGR_test import ( "context" "fmt" - "math/rand" "sync" "testing" "time" @@ -64,7 +63,6 @@ func TestBasic(t *testing.T) { func testGeneric(t *testing.T, n, f int, reliable bool) { t.Parallel() - rand.Seed(time.Now().UnixNano()) log := testlogger.NewLogger(t) defer log.Sync() // diff --git a/packages/chain/dss/dss_test.go b/packages/chain/dss/dss_test.go index 5032687b9f..3cab8e52c1 100644 --- a/packages/chain/dss/dss_test.go +++ b/packages/chain/dss/dss_test.go @@ -5,9 +5,7 @@ package dss_test import ( "bytes" - "math/rand" "testing" - "time" "github.com/stretchr/testify/require" "go.dedis.ch/kyber/v3" @@ -22,7 +20,6 @@ import ( ) func TestBasic(t *testing.T) { - rand.Seed(time.Now().UnixNano()) log := testlogger.WithLevel(testlogger.NewLogger(t), logger.LevelWarn, false) defer log.Sync() suite := tcrypto.DefaultEd25519Suite() diff --git a/packages/chain/dss/trivial_dkg_test.go b/packages/chain/dss/trivial_dkg_test.go index bd68688554..56b181a552 100644 --- a/packages/chain/dss/trivial_dkg_test.go +++ b/packages/chain/dss/trivial_dkg_test.go @@ -8,9 +8,7 @@ package dss_test import ( - "math/rand" "testing" - "time" "go.dedis.ch/kyber/v3" "go.dedis.ch/kyber/v3/share" @@ -26,7 +24,6 @@ import ( func TestDSS(t *testing.T) { n := 4 f := 1 - rand.Seed(time.Now().UnixNano()) suite := tcrypto.DefaultEd25519Suite() nodeIDs := gpa.MakeTestNodeIDs(n) nodeSKs := map[gpa.NodeID]kyber.Scalar{} diff --git a/packages/chain/mempool/distSync/distSync_test.go b/packages/chain/mempool/distSync/distSync_test.go index c581001707..fd2df7f8c8 100644 --- a/packages/chain/mempool/distSync/distSync_test.go +++ b/packages/chain/mempool/distSync/distSync_test.go @@ -23,7 +23,6 @@ func TestBasic(t *testing.T) { func testBasic(t *testing.T, n, cmtN, cmtF int) { require.GreaterOrEqual(t, n, cmtN) - rand.Seed(time.Now().UnixNano()) log := testlogger.NewLogger(t) kp := cryptolib.NewKeyPair() rnd := rand.New(rand.NewSource(time.Now().UnixNano())) diff --git a/packages/chain/mempool/mempool_test.go b/packages/chain/mempool/mempool_test.go index 81131c8cb2..e76166be06 100644 --- a/packages/chain/mempool/mempool_test.go +++ b/packages/chain/mempool/mempool_test.go @@ -80,7 +80,6 @@ func TestBasic(t *testing.T) { // - Get proposals -- all received 1 request. func testBasic(t *testing.T, n, f int, reliable bool) { t.Parallel() - rand.Seed(time.Now().UnixNano()) te := newEnv(t, n, f, reliable) defer te.close() chainInitReqs := te.tcl.MakeTxChainInit() @@ -207,7 +206,6 @@ func TestTimeLock(t *testing.T) { func testTimeLock(t *testing.T, n, f int, reliable bool) { //nolint: gocyclo t.Parallel() - rand.Seed(time.Now().UnixNano()) te := newEnv(t, n, f, reliable) defer te.close() start := time.Now() @@ -325,7 +323,6 @@ func TestExpiration(t *testing.T) { func testExpiration(t *testing.T, n, f int, reliable bool) { t.Parallel() - rand.Seed(time.Now().UnixNano()) te := newEnv(t, n, f, reliable) defer te.close() start := time.Now() diff --git a/packages/chain/mempool/time_pool_test.go b/packages/chain/mempool/time_pool_test.go index 51c0159cd9..9cc5f5c044 100644 --- a/packages/chain/mempool/time_pool_test.go +++ b/packages/chain/mempool/time_pool_test.go @@ -4,7 +4,6 @@ package mempool_test import ( - "math/rand" "testing" "time" @@ -18,7 +17,6 @@ import ( ) func TestTimePoolBasic(t *testing.T) { - rand.Seed(time.Now().UnixNano()) kp := cryptolib.NewKeyPair() tp := mempool.NewTimePool() t0 := time.Now() diff --git a/packages/chain/mempool/wait_req_test.go b/packages/chain/mempool/wait_req_test.go index e34793ff28..62d04869eb 100644 --- a/packages/chain/mempool/wait_req_test.go +++ b/packages/chain/mempool/wait_req_test.go @@ -5,9 +5,7 @@ package mempool_test import ( "context" - "math/rand" "testing" - "time" "github.com/stretchr/testify/require" @@ -17,7 +15,6 @@ import ( ) func TestWaitReq(t *testing.T) { - rand.Seed(time.Now().UnixNano()) kp := cryptolib.NewKeyPair() ctxA := context.Background() diff --git a/packages/chain/node_test.go b/packages/chain/node_test.go index 53e407ad49..53bb9bbad1 100644 --- a/packages/chain/node_test.go +++ b/packages/chain/node_test.go @@ -72,7 +72,6 @@ func TestBasic(t *testing.T) { //nolint:gocyclo func testBasic(t *testing.T, n, f int, reliable bool, timeout time.Duration) { t.Parallel() - rand.Seed(time.Now().UnixNano()) te := newEnv(t, n, f, reliable) defer te.close()