diff options
author | 2017-03-17 00:20:55 -0700 | |
---|---|---|
committer | 2017-03-17 07:20:55 +0000 | |
commit | 7dc431ada3909aba9dfeaf64003718e0ea4d43b9 (patch) | |
tree | 04792744ba4202d44a0aa5fb8fa820805235ed56 /test | |
parent | dfc71df07d7a19cc0227083ce6b04eea60ecd5a0 (diff) | |
download | coredns-7dc431ada3909aba9dfeaf64003718e0ea4d43b9.tar.gz coredns-7dc431ada3909aba9dfeaf64003718e0ea4d43b9.tar.zst coredns-7dc431ada3909aba9dfeaf64003718e0ea4d43b9.zip |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/proxy_http_health_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/proxy_http_health_test.go b/test/proxy_http_health_test.go index 9bfc3b209..b190f2b45 100644 --- a/test/proxy_http_health_test.go +++ b/test/proxy_http_health_test.go @@ -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 { |