middleware/proxy: fix race; add Go 1.7 backward compatibility (#603)

* Fix race on backend health status update
* Ensure test case is compatible on Go 1.7
This commit is contained in:
Michael S. Fischer
2017-03-17 00:20:55 -07:00
committed by Miek Gieben
parent dfc71df07d
commit 7dc431ada3
3 changed files with 13 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"io"
"io/ioutil"
"log"
"net"
"net/http"
"net/http/httptest"
"net/url"
@@ -29,7 +30,11 @@ func TestProxyWithHTTPCheckOK(t *testing.T) {
if err != nil {
t.Fatal(err)
}
healthCheckPort := healthCheckURL.Port()
// TODO: use URL.Port() (Go 1.8+) once we've deprecated Go 1.7 support
var healthCheckPort string
if _, healthCheckPort, err = net.SplitHostPort(healthCheckURL.Host); err != nil {
healthCheckPort = "80"
}
name, rm, err := test.TempFile(".", exampleOrg)
if err != nil {