drop legacy rand.Seed

This commit is contained in:
Umputun 2023-02-27 14:51:25 -06:00
parent 96904fe7c5
commit 197246a05a
3 changed files with 2 additions and 5 deletions

View File

@ -416,7 +416,6 @@ func makeSSLConfig() (config proxy.SSLConfig, err error) {
func makeLBSelector() func(len int) int {
switch opts.LBType {
case "random":
rand.Seed(time.Now().UnixNano())
return rand.Intn
case "failover":
return func(int) int { return 0 } // dead server won't be in the list, we can safely pick the first one

View File

@ -156,7 +156,6 @@ func Test_MainWithSSL(t *testing.T) {
}
func Test_MainWithPlugin(t *testing.T) {
rand.Seed(time.Now().UnixNano())
proxyPort := rand.Intn(10000) + 40000
conductorPort := rand.Intn(10000) + 40000
os.Args = []string{"test", "--static.enabled",
@ -329,7 +328,7 @@ func waitForHTTPServerStart(port int) {
type TestPlugin struct{}
//nolint
// nolint
func (h *TestPlugin) HeaderThing(req *lib.Request, res *lib.Response) (err error) {
log.Printf("req: %+v", req)
res.HeadersIn = http.Header{}
@ -340,7 +339,7 @@ func (h *TestPlugin) HeaderThing(req *lib.Request, res *lib.Response) (err error
return nil
}
//nolint
// nolint
func (h *TestPlugin) ErrorThing(req lib.Request, res *lib.Response) (err error) {
log.Printf("req: %+v", req)
if req.URL == "/fail" {

View File

@ -318,7 +318,6 @@ func TestConductor_MiddlewarePluginBadStatus(t *testing.T) {
},
}
rand.Seed(time.Now().UnixNano())
port := rand.Intn(30000)
c := Conductor{RPCDialer: dialer, Address: "127.0.0.1:" + strconv.Itoa(30000+port)}