fix by golint (#1822)

This commit is contained in:
fatedier
2020-05-24 17:48:37 +08:00
committed by GitHub
parent 2170c481ce
commit 8b75b8b837
80 changed files with 1315 additions and 1324 deletions

View File

@@ -102,7 +102,7 @@ func TestHealthCheck(t *testing.T) {
var healthMu sync.RWMutex
svc1Health := true
svc2Health := true
httpSvc1 := mock.NewHttpServer(15003, func(w http.ResponseWriter, r *http.Request) {
httpSvc1 := mock.NewHTTPServer(15003, func(w http.ResponseWriter, r *http.Request) {
if strings.Contains(r.URL.Path, "health") {
healthMu.RLock()
defer healthMu.RUnlock()
@@ -120,7 +120,7 @@ func TestHealthCheck(t *testing.T) {
defer httpSvc1.Stop()
}
httpSvc2 := mock.NewHttpServer(15004, func(w http.ResponseWriter, r *http.Request) {
httpSvc2 := mock.NewHTTPServer(15004, func(w http.ResponseWriter, r *http.Request) {
if strings.Contains(r.URL.Path, "health") {
healthMu.RLock()
defer healthMu.RUnlock()
@@ -138,7 +138,7 @@ func TestHealthCheck(t *testing.T) {
defer httpSvc2.Stop()
}
httpSvc3 := mock.NewHttpServer(15005, func(w http.ResponseWriter, r *http.Request) {
httpSvc3 := mock.NewHTTPServer(15005, func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("http3"))
})
err = httpSvc3.Start()
@@ -146,7 +146,7 @@ func TestHealthCheck(t *testing.T) {
defer httpSvc3.Stop()
}
httpSvc4 := mock.NewHttpServer(15006, func(w http.ResponseWriter, r *http.Request) {
httpSvc4 := mock.NewHTTPServer(15006, func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("http4"))
})
err = httpSvc4.Start()
@@ -185,11 +185,11 @@ func TestHealthCheck(t *testing.T) {
// ****** healcheck type tcp ******
// echo1 and echo2 is ok
result := make([]string, 0)
res, err := util.SendTcpMsg("127.0.0.1:15000", "echo")
res, err := util.SendTCPMsg("127.0.0.1:15000", "echo")
assert.NoError(err)
result = append(result, res)
res, err = util.SendTcpMsg("127.0.0.1:15000", "echo")
res, err = util.SendTCPMsg("127.0.0.1:15000", "echo")
assert.NoError(err)
result = append(result, res)
@@ -201,11 +201,11 @@ func TestHealthCheck(t *testing.T) {
time.Sleep(1200 * time.Millisecond)
result = make([]string, 0)
res, err = util.SendTcpMsg("127.0.0.1:15000", "echo")
res, err = util.SendTCPMsg("127.0.0.1:15000", "echo")
assert.NoError(err)
result = append(result, res)
res, err = util.SendTcpMsg("127.0.0.1:15000", "echo")
res, err = util.SendTCPMsg("127.0.0.1:15000", "echo")
assert.NoError(err)
result = append(result, res)
@@ -221,11 +221,11 @@ func TestHealthCheck(t *testing.T) {
time.Sleep(1200 * time.Millisecond)
result = make([]string, 0)
res, err = util.SendTcpMsg("127.0.0.1:15000", "echo")
res, err = util.SendTCPMsg("127.0.0.1:15000", "echo")
assert.NoError(err)
result = append(result, res)
res, err = util.SendTcpMsg("127.0.0.1:15000", "echo")
res, err = util.SendTCPMsg("127.0.0.1:15000", "echo")
assert.NoError(err)
result = append(result, res)
@@ -234,12 +234,12 @@ func TestHealthCheck(t *testing.T) {
// ****** healcheck type http ******
// http1 and http2 is ok
code, body, _, err := util.SendHttpMsg("GET", "http://127.0.0.1:14000/xxx", "test1.com", nil, "")
code, body, _, err := util.SendHTTPMsg("GET", "http://127.0.0.1:14000/xxx", "test1.com", nil, "")
assert.NoError(err)
assert.Equal(200, code)
assert.Equal("http1", body)
code, body, _, err = util.SendHttpMsg("GET", "http://127.0.0.1:14000/xxx", "test2.com", nil, "")
code, body, _, err = util.SendHTTPMsg("GET", "http://127.0.0.1:14000/xxx", "test2.com", nil, "")
assert.NoError(err)
assert.Equal(200, code)
assert.Equal("http2", body)
@@ -250,12 +250,12 @@ func TestHealthCheck(t *testing.T) {
healthMu.Unlock()
time.Sleep(1200 * time.Millisecond)
code, body, _, err = util.SendHttpMsg("GET", "http://127.0.0.1:14000/xxx", "test1.com", nil, "")
code, body, _, err = util.SendHTTPMsg("GET", "http://127.0.0.1:14000/xxx", "test1.com", nil, "")
assert.NoError(err)
assert.Equal(200, code)
assert.Equal("http1", body)
code, _, _, err = util.SendHttpMsg("GET", "http://127.0.0.1:14000/xxx", "test2.com", nil, "")
code, _, _, err = util.SendHTTPMsg("GET", "http://127.0.0.1:14000/xxx", "test2.com", nil, "")
assert.NoError(err)
assert.Equal(404, code)
@@ -265,12 +265,12 @@ func TestHealthCheck(t *testing.T) {
healthMu.Unlock()
time.Sleep(1200 * time.Millisecond)
code, body, _, err = util.SendHttpMsg("GET", "http://127.0.0.1:14000/xxx", "test1.com", nil, "")
code, body, _, err = util.SendHTTPMsg("GET", "http://127.0.0.1:14000/xxx", "test1.com", nil, "")
assert.NoError(err)
assert.Equal(200, code)
assert.Equal("http1", body)
code, body, _, err = util.SendHttpMsg("GET", "http://127.0.0.1:14000/xxx", "test2.com", nil, "")
code, body, _, err = util.SendHTTPMsg("GET", "http://127.0.0.1:14000/xxx", "test2.com", nil, "")
assert.NoError(err)
assert.Equal(200, code)
assert.Equal("http2", body)
@@ -278,12 +278,12 @@ func TestHealthCheck(t *testing.T) {
// ****** load balancing type http ******
result = make([]string, 0)
code, body, _, err = util.SendHttpMsg("GET", "http://127.0.0.1:14000/xxx", "test.balancing.com", nil, "")
code, body, _, err = util.SendHTTPMsg("GET", "http://127.0.0.1:14000/xxx", "test.balancing.com", nil, "")
assert.NoError(err)
assert.Equal(200, code)
result = append(result, body)
code, body, _, err = util.SendHttpMsg("GET", "http://127.0.0.1:14000/xxx", "test.balancing.com", nil, "")
code, body, _, err = util.SendHTTPMsg("GET", "http://127.0.0.1:14000/xxx", "test.balancing.com", nil, "")
assert.NoError(err)
assert.Equal(200, code)
result = append(result, body)