mirror of
https://github.com/umputun/reproxy.git
synced 2024-08-17 12:40:30 +03:00
drop legacy rand.Seed
This commit is contained in:
parent
96904fe7c5
commit
197246a05a
@ -416,7 +416,6 @@ func makeSSLConfig() (config proxy.SSLConfig, err error) {
|
|||||||
func makeLBSelector() func(len int) int {
|
func makeLBSelector() func(len int) int {
|
||||||
switch opts.LBType {
|
switch opts.LBType {
|
||||||
case "random":
|
case "random":
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
return rand.Intn
|
return rand.Intn
|
||||||
case "failover":
|
case "failover":
|
||||||
return func(int) int { return 0 } // dead server won't be in the list, we can safely pick the first one
|
return func(int) int { return 0 } // dead server won't be in the list, we can safely pick the first one
|
||||||
|
@ -156,7 +156,6 @@ func Test_MainWithSSL(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Test_MainWithPlugin(t *testing.T) {
|
func Test_MainWithPlugin(t *testing.T) {
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
proxyPort := rand.Intn(10000) + 40000
|
proxyPort := rand.Intn(10000) + 40000
|
||||||
conductorPort := rand.Intn(10000) + 40000
|
conductorPort := rand.Intn(10000) + 40000
|
||||||
os.Args = []string{"test", "--static.enabled",
|
os.Args = []string{"test", "--static.enabled",
|
||||||
@ -329,7 +328,7 @@ func waitForHTTPServerStart(port int) {
|
|||||||
|
|
||||||
type TestPlugin struct{}
|
type TestPlugin struct{}
|
||||||
|
|
||||||
//nolint
|
// nolint
|
||||||
func (h *TestPlugin) HeaderThing(req *lib.Request, res *lib.Response) (err error) {
|
func (h *TestPlugin) HeaderThing(req *lib.Request, res *lib.Response) (err error) {
|
||||||
log.Printf("req: %+v", req)
|
log.Printf("req: %+v", req)
|
||||||
res.HeadersIn = http.Header{}
|
res.HeadersIn = http.Header{}
|
||||||
@ -340,7 +339,7 @@ func (h *TestPlugin) HeaderThing(req *lib.Request, res *lib.Response) (err error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint
|
// nolint
|
||||||
func (h *TestPlugin) ErrorThing(req lib.Request, res *lib.Response) (err error) {
|
func (h *TestPlugin) ErrorThing(req lib.Request, res *lib.Response) (err error) {
|
||||||
log.Printf("req: %+v", req)
|
log.Printf("req: %+v", req)
|
||||||
if req.URL == "/fail" {
|
if req.URL == "/fail" {
|
||||||
|
@ -318,7 +318,6 @@ func TestConductor_MiddlewarePluginBadStatus(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
port := rand.Intn(30000)
|
port := rand.Intn(30000)
|
||||||
c := Conductor{RPCDialer: dialer, Address: "127.0.0.1:" + strconv.Itoa(30000+port)}
|
c := Conductor{RPCDialer: dialer, Address: "127.0.0.1:" + strconv.Itoa(30000+port)}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user