mirror of
https://github.com/coredns/coredns.git
synced 2025-12-06 02:15:11 -05:00
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:
committed by
Miek Gieben
parent
dfc71df07d
commit
7dc431ada3
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user