diff options
author | Valery Piashchynski <[email protected]> | 2020-03-08 16:18:58 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-03-08 16:18:58 +0300 |
commit | eae742dff18b89084d1754918015d9c69e626ed3 (patch) | |
tree | 555feb36fb77ac13af2ae53b0a07287f0b0ca026 /service/http | |
parent | 617eb5a965fd70c150754bc661c4d19eb3a8d184 (diff) |
fix bug with totally frozed rr
Diffstat (limited to 'service/http')
-rw-r--r-- | service/http/rpc_test.go | 22 | ||||
-rw-r--r-- | service/http/service_test.go | 4 | ||||
-rw-r--r-- | service/http/ssl_test.go | 4 |
3 files changed, 15 insertions, 15 deletions
diff --git a/service/http/rpc_test.go b/service/http/rpc_test.go index 1971f237..c73f2a91 100644 --- a/service/http/rpc_test.go +++ b/service/http/rpc_test.go @@ -26,7 +26,7 @@ func Test_RPC(t *testing.T) { rpcCfg: `{"enable":true, "listen":"tcp://:5004"}`, httpCfg: `{ "enable": true, - "address": ":6029", + "address": ":16031", "maxRequestSize": 1024, "uploads": { "dir": ` + tmpDir() + `, @@ -58,7 +58,7 @@ func Test_RPC(t *testing.T) { time.Sleep(time.Second) - res, _, err := get("http://localhost:6029") + res, _, err := get("http://localhost:16031") if err != nil { t.Fatal(err) } @@ -71,9 +71,9 @@ func Test_RPC(t *testing.T) { assert.NoError(t, cl.Call("http.Reset", true, &r)) assert.Equal(t, "OK", r) - res2, _, err := get("http://localhost:6029") + res2, _, err := get("http://localhost:16031") if err != nil { - t.Fatal() + t.Fatal(err) } assert.Equal(t, strconv.Itoa(*ss.rr.Workers()[0].Pid), res2) assert.NotEqual(t, res, res2) @@ -99,7 +99,7 @@ func Test_RPC_Unix(t *testing.T) { rpcCfg: `{"enable":true, "listen":` + string(j) + `}`, httpCfg: `{ "enable": true, - "address": ":6029", + "address": ":6032", "maxRequestSize": 1024, "uploads": { "dir": ` + tmpDir() + `, @@ -129,9 +129,9 @@ func Test_RPC_Unix(t *testing.T) { } }() - time.Sleep(time.Second) + time.Sleep(time.Millisecond * 500) - res, _, err := get("http://localhost:6029") + res, _, err := get("http://localhost:6032") if err != nil { c.Stop() t.Fatal(err) @@ -153,7 +153,7 @@ func Test_RPC_Unix(t *testing.T) { assert.NoError(t, cl.Call("http.Reset", true, &r)) assert.Equal(t, "OK", r) - res2, _, err := get("http://localhost:6029") + res2, _, err := get("http://localhost:6032") if err != nil { c.Stop() t.Fatal(err) @@ -175,7 +175,7 @@ func Test_Workers(t *testing.T) { rpcCfg: `{"enable":true, "listen":"tcp://:5005"}`, httpCfg: `{ "enable": true, - "address": ":6029", + "address": ":6033", "maxRequestSize": 1024, "uploads": { "dir": ` + tmpDir() + `, @@ -204,8 +204,7 @@ func Test_Workers(t *testing.T) { t.Errorf("error during the Serve: error %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() + time.Sleep(time.Millisecond * 500) cl, err := rs.Client() assert.NoError(t, err) @@ -215,6 +214,7 @@ func Test_Workers(t *testing.T) { assert.Len(t, r.Workers, 1) assert.Equal(t, *ss.rr.Workers()[0].Pid, r.Workers[0].Pid) + c.Stop() } func Test_Errors(t *testing.T) { diff --git a/service/http/service_test.go b/service/http/service_test.go index 1a1c32ae..1d8af9c0 100644 --- a/service/http/service_test.go +++ b/service/http/service_test.go @@ -176,7 +176,7 @@ func Test_Service_Env(t *testing.T) { assert.NoError(t, c.Init(&testCfg{httpCfg: `{ "enable": true, - "address": ":6031", + "address": ":10031", "maxRequestSize": 1024, "uploads": { "dir": ` + tmpDir() + `, @@ -209,7 +209,7 @@ func Test_Service_Env(t *testing.T) { time.Sleep(time.Second * 1) - req, err := http.NewRequest("GET", "http://localhost:6031", nil) + req, err := http.NewRequest("GET", "http://localhost:10031", nil) assert.NoError(t, err) r, err := http.DefaultClient.Do(req) diff --git a/service/http/ssl_test.go b/service/http/ssl_test.go index c650a266..cf147be9 100644 --- a/service/http/ssl_test.go +++ b/service/http/ssl_test.go @@ -142,7 +142,7 @@ func Test_SSL_Service_Redirect(t *testing.T) { c.Register(ID, &Service{}) assert.NoError(t, c.Init(&testCfg{httpCfg: `{ - "address": ":6031", + "address": ":6831", "ssl": { "port": 6902, "redirect": true, @@ -171,7 +171,7 @@ func Test_SSL_Service_Redirect(t *testing.T) { time.Sleep(time.Millisecond * 500) - req, err := http.NewRequest("GET", "http://localhost:6031?hello=world", nil) + req, err := http.NewRequest("GET", "http://localhost:6831?hello=world", nil) assert.NoError(t, err) r, err := sslClient.Do(req) |