File tree Expand file tree Collapse file tree
central/processindicator/pruner
kubernetes/listener/resources Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,7 +64,6 @@ func processToIDAndArgs(process *storage.ProcessIndicator) processindicator.IDAn
6464}
6565
6666func TestRabbitMQPruning (t * testing.T ) {
67- rand .Seed (time .Now ().UnixNano ())
6867 var processes []processindicator.IDAndArgs
6968 processes = append (processes , processToIDAndArgs (deterministicRabbitMQProcess ))
7069 for i := 0 ; i < 1000 ; i ++ {
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package compliance
22
33import (
44 "context"
5- "math/rand"
65 "os"
76 "os/signal"
87 "syscall"
@@ -61,9 +60,6 @@ func (c *Compliance) Start() {
6160 log .Infof ("Running StackRox Version: %s" , version .GetMainVersion ())
6261 clientconn .SetUserAgent (clientconn .Compliance )
6362
64- // Set the random seed based on the current time.
65- rand .Seed (time .Now ().UnixNano ())
66-
6763 // Start the prometheus metrics server
6864 metrics .NewServer (metrics .ComplianceSubsystem , metrics .NewTLSConfigurerFromEnv ()).RunForever ()
6965 metrics .GatherThrottleMetricsForever (metrics .ComplianceSubsystem .String ())
Original file line number Diff line number Diff line change @@ -156,9 +156,9 @@ func doTestCloneMigrationFailureAndReentry(t *testing.T) {
156156 },
157157 }
158158 // For the parameters that should not matter, run pseudo random to get coverage on different cases
159- rand .Seed ( 8181818 )
159+ r := rand .New ( rand . NewSource ( 8181818 ) )
160160 for _ , c := range testCases {
161- reboot := rand .Intn (2 ) == 1
161+ reboot := r .Intn (2 ) == 1
162162 if reboot {
163163 c .description = c .description + " with reboot"
164164 }
@@ -436,9 +436,9 @@ func doTestRollback(t *testing.T) {
436436 breakPoint : breakAfterGetClone ,
437437 },
438438 }
439- rand .Seed ( 8056 )
439+ r := rand .New ( rand . NewSource ( 8056 ) )
440440 for _ , c := range testCases {
441- reboot := rand .Intn (2 ) == 1
441+ reboot := r .Intn (2 ) == 1
442442 if reboot {
443443 c .description = c .description + " with reboot"
444444 }
Original file line number Diff line number Diff line change 44 "fmt"
55 "math/rand"
66 "testing"
7- "time"
87
98 "github.com/stackrox/rox/generated/storage"
109 "github.com/stackrox/rox/sensor/common/selector"
@@ -26,11 +25,6 @@ type namespaceAndSelector struct {
2625 selector selector.Selector
2726}
2827
29- func init () {
30- rand .Seed (time .Now ().UnixNano ())
31-
32- }
33-
3428// BenchmarkBuildDeployments_NoChange uses one deployment and generates
3529// 10k updates without meaningful change. This is to test that
3630// we don't do useless clones if the object is the same.
Original file line number Diff line number Diff line change 55 "math/rand"
66 "net"
77 "testing"
8- "time"
98
109 "github.com/stackrox/rox/generated/internalapi/central"
1110 "github.com/stackrox/rox/generated/storage"
4039)
4140
4241func init () {
43- rand .Seed (time .Now ().UnixNano ())
44-
4542 serviceAccounts = make ([]string , 1000 )
4643 for i := 0 ; i < 1000 ; i ++ {
4744 serviceAccounts [i ] = randString (5 )
You can’t perform that action at this time.
0 commit comments