Skip to content

Commit

Permalink
all: fix math/rand deprecations
Browse files Browse the repository at this point in the history
Change-Id: I4b966375697c0d409ce24cc7604f806973f8f22a
  • Loading branch information
egonelbre committed Feb 17, 2023
1 parent aba2f14 commit 0cdef95
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 18 deletions.
4 changes: 1 addition & 3 deletions cmd/uplink/ulimit_other.go
Expand Up @@ -6,6 +6,4 @@

package main

func raiseUlimits() {
return
}
func raiseUlimits() {}
2 changes: 1 addition & 1 deletion multinode/multinodedb/dbx/gen.sh
Expand Up @@ -4,7 +4,7 @@ set -e pipefail
dbx schema -d pgx -d sqlite3 multinodedb.dbx .
dbx golang -d pgx -d sqlite3 -p dbx -t templates multinodedb.dbx .

( printf '%s\n' '//lint:file-ignore U1000,ST1012 generated file'; cat multinodedb.dbx.go ) > multinodedb.dbx.go.tmp && mv multinodedb.dbx.go.tmp multinodedb.dbx.go
( printf '%s\n' '//lint:file-ignore U1000,ST1012,SA1019 generated file'; cat multinodedb.dbx.go ) > multinodedb.dbx.go.tmp && mv multinodedb.dbx.go.tmp multinodedb.dbx.go
gofmt -r "*sql.Tx -> tagsql.Tx" -w multinodedb.dbx.go
gofmt -r "*sql.Rows -> tagsql.Rows" -w multinodedb.dbx.go
perl -0777 -pi \
Expand Down
2 changes: 1 addition & 1 deletion multinode/multinodedb/dbx/multinodedb.dbx.go
@@ -1,4 +1,4 @@
//lint:file-ignore U1000,ST1012 generated file
//lint:file-ignore U1000,ST1012,SA1019 generated file
// AUTOGENERATED BY storj.io/dbx
// DO NOT EDIT.

Expand Down
3 changes: 0 additions & 3 deletions satellite/gracefulexit/gracefulexit_test.go
Expand Up @@ -296,7 +296,6 @@ func TestGracefulExit_CopiedObjects(t *testing.T) {
// TestGracefulExit_Enqueue_And_DeleteAllFinishedTransferQueueItems_batch
// ensures that deletion works as expected using different batch sizes.
func TestGracefulExit_Enqueue_And_DeleteAllFinishedTransferQueueItems_batchsize(t *testing.T) {
rand.Seed(time.Now().UnixNano())
var testCases = []struct {
name string
batchSize int
Expand Down Expand Up @@ -400,8 +399,6 @@ func generateExitedNodes(t *testing.T, ctx *testcontext.Context, db satellite.DB
// the CRDB batch logic for delete all the transfer queue items of exited nodes
// works as expected.
func TestGracefulExit_DeleteAllFinishedTransferQueueItems_batch(t *testing.T) {
rand.Seed(time.Now().UnixNano())

satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
const (
addr = "127.0.1.0:8080"
Expand Down
1 change: 0 additions & 1 deletion satellite/repair/queue/queue2_test.go
Expand Up @@ -160,7 +160,6 @@ func testorderHealthyPieces(t *testing.T, connStr string) {
{uuid.UUID{'h'}, 10, time.Now().Add(-8 * time.Hour)},
}
// shuffle list since select order should not depend on insert order
rand.Seed(time.Now().UnixNano())
rand.Shuffle(len(injuredSegList), func(i, j int) {
injuredSegList[i], injuredSegList[j] = injuredSegList[j], injuredSegList[i]
})
Expand Down
2 changes: 1 addition & 1 deletion testsuite/storjscan/go.mod
Expand Up @@ -5,7 +5,6 @@ go 1.18
replace storj.io/storj => ../../

require (
github.com/spacemonkeygo/monkit/v3 v3.0.19
github.com/stretchr/testify v1.8.0
github.com/zeebo/errs v1.3.0
go.uber.org/zap v1.21.0
Expand Down Expand Up @@ -108,6 +107,7 @@ require (
github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spacemonkeygo/monkit/v3 v3.0.19 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spf13/cobra v1.1.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down
3 changes: 0 additions & 3 deletions testsuite/storjscan/storjscantest/run.go
Expand Up @@ -9,7 +9,6 @@ import (
"testing"
"time"

"github.com/spacemonkeygo/monkit/v3"
"github.com/zeebo/errs"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
Expand All @@ -29,8 +28,6 @@ import (
"storj.io/uplink"
)

var mon = monkit.Package()

// Stack contains references to storjscan app and eth test network.
type Stack struct {
Log *zap.Logger
Expand Down
8 changes: 3 additions & 5 deletions versioncontrol/peer_test.go
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"encoding/hex"
"io"
"math/rand"
"net/http"
"reflect"
"strings"
Expand All @@ -18,6 +17,7 @@ import (
"golang.org/x/sync/errgroup"

"storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/storj/versioncontrol"
)

Expand Down Expand Up @@ -363,16 +363,14 @@ func randRollout(t *testing.T) versioncontrol.RolloutConfig {

return versioncontrol.RolloutConfig{
Seed: randSeedString(t),
Cursor: rand.Intn(101),
Cursor: testrand.Intn(101),
}
}

func randSeedString(t *testing.T) string {
t.Helper()

seed := make([]byte, 32)
_, err := rand.Read(seed)
require.NoError(t, err)

testrand.Read(seed)
return hex.EncodeToString(seed)
}

0 comments on commit 0cdef95

Please sign in to comment.