integration: Add tests for healthmon

This commit is contained in:
Tatsuhiro Tsujikawa 2016-06-17 00:24:14 +09:00
parent fa8bccbae2
commit 43d595b7f3
3 changed files with 57 additions and 0 deletions

View File

@ -942,3 +942,22 @@ backend=127.0.0.1,3011
t.Errorf("apiResp.Status: %v; want %v", got, want) t.Errorf("apiResp.Status: %v; want %v", got, want)
} }
} }
// TestH1Healthmon tests health monitor endpoint.
func TestH1Healthmon(t *testing.T) {
st := newServerTesterConnectPort([]string{"-f127.0.0.1,3011;healthmon;no-tls"}, t, func(w http.ResponseWriter, r *http.Request) {
t.Fatalf("request should not be forwarded")
}, 3011)
defer st.Close()
res, err := st.http1(requestParam{
name: "TestH1Healthmon",
path: "/alpha/bravo",
})
if err != nil {
t.Fatalf("Error st.http1() = %v", err)
}
if got, want := res.status, 200; got != want {
t.Errorf("res.status: %v; want %v", got, want)
}
}

View File

@ -1992,3 +1992,22 @@ backend=127.0.0.1,3011
t.Errorf("apiResp.Status: %v; want %v", got, want) t.Errorf("apiResp.Status: %v; want %v", got, want)
} }
} }
// TestH2Healthmon tests health monitor endpoint.
func TestH2Healthmon(t *testing.T) {
st := newServerTesterConnectPort([]string{"-f127.0.0.1,3011;healthmon;no-tls"}, t, func(w http.ResponseWriter, r *http.Request) {
t.Fatalf("request should not be forwarded")
}, 3011)
defer st.Close()
res, err := st.http2(requestParam{
name: "TestH2Healthmon",
path: "/alpha/bravo",
})
if err != nil {
t.Fatalf("Error st.http2() = %v", err)
}
if got, want := res.status, 200; got != want {
t.Errorf("res.status: %v; want %v", got, want)
}
}

View File

@ -623,3 +623,22 @@ backend=127.0.0.1,3011
t.Errorf("apiResp.Status: %v; want %v", got, want) t.Errorf("apiResp.Status: %v; want %v", got, want)
} }
} }
// TestS3Healthmon tests health monitor endpoint.
func TestS3Healthmon(t *testing.T) {
st := newServerTesterTLSConnectPort([]string{"--npn-list=spdy/3.1", "-f127.0.0.1,3011;healthmon"}, t, func(w http.ResponseWriter, r *http.Request) {
t.Fatalf("request should not be forwarded")
}, 3011)
defer st.Close()
res, err := st.spdy(requestParam{
name: "TestS3Healthmon",
path: "/alpha/bravo",
})
if err != nil {
t.Fatalf("Error st.spdy() = %v", err)
}
if got, want := res.status, 200; got != want {
t.Errorf("res.status: %v; want %v", got, want)
}
}