Compare commits
1
Commits
bbb435b034
..
next
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdabf4974b |
@@ -61,13 +61,19 @@ func TestHealthCheck(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Another test can take a closed server's port at once, so the app's
|
// Another test can take a closed server's port at once, so the app's
|
||||||
// address here is one that nothing can listen on: TCP cannot connect
|
// address here is a multicast address, to which TCP cannot connect.
|
||||||
// to a multicast address such as 224.0.0.1.
|
|
||||||
wantHealthCheck(t, map[string]string{
|
wantHealthCheck(t, map[string]string{
|
||||||
listenAddr: ":" + port,
|
listenAddr: ":" + port,
|
||||||
upstreamURL: "http://224.0.0.1",
|
upstreamURL: "http://224.0.0.1",
|
||||||
}, 1, "unhealthy: connect to the app: ")
|
}, 1, "unhealthy: connect to the app: ")
|
||||||
|
|
||||||
|
// Listening on port 0 takes any free port, so nothing listens on port 0
|
||||||
|
// itself.
|
||||||
|
wantHealthCheck(t, map[string]string{listenAddr: ":0"}, 1,
|
||||||
|
"unhealthy: ask smallwebwaf: ")
|
||||||
|
wantHealthCheck(t, map[string]string{listenAddr: "8080"}, 1,
|
||||||
|
"unhealthy: invalid setting: SWWAF_LISTEN_ADDR: ")
|
||||||
|
|
||||||
stop()
|
stop()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
@@ -75,13 +81,6 @@ func TestHealthCheck(t *testing.T) {
|
|||||||
case <-time.After(waitLimit):
|
case <-time.After(waitLimit):
|
||||||
t.Fatal("still running after being told to stop")
|
t.Fatal("still running after being told to stop")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listening on port 0 takes any free port, so nothing listens on port 0
|
|
||||||
// itself.
|
|
||||||
wantHealthCheck(t, map[string]string{listenAddr: ":0"}, 1,
|
|
||||||
"unhealthy: ask smallwebwaf: ")
|
|
||||||
wantHealthCheck(t, map[string]string{listenAddr: "8080"}, 1,
|
|
||||||
"unhealthy: invalid setting: SWWAF_LISTEN_ADDR: ")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHealthCheckRefusesAnArgument(t *testing.T) {
|
func TestHealthCheckRefusesAnArgument(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user