vendor updates

This commit is contained in:
Serguei Bezverkhi
2018-03-06 17:33:18 -05:00
parent 4b3ebc171b
commit e9033989a0
5854 changed files with 248382 additions and 119809 deletions

View File

@ -21,8 +21,7 @@ go_library(
go_test(
name = "go_default_test",
srcs = ["http_test.go"],
importpath = "k8s.io/kubernetes/pkg/probe/http",
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//pkg/probe:go_default_library"],
)

View File

@ -52,6 +52,16 @@ func TestHTTPProbeChecker(t *testing.T) {
w.Write([]byte(output))
}
redirectHandler := func(s int, bad bool) func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
http.Redirect(w, r, "/new", s)
} else if bad && r.URL.Path == "/new" {
w.WriteHeader(http.StatusInternalServerError)
}
}
}
prober := New()
testCases := []struct {
handler func(w http.ResponseWriter, r *http.Request)
@ -122,6 +132,38 @@ func TestHTTPProbeChecker(t *testing.T) {
},
health: probe.Failure,
},
{
handler: redirectHandler(http.StatusMovedPermanently, false), // 301
health: probe.Success,
},
{
handler: redirectHandler(http.StatusMovedPermanently, true), // 301
health: probe.Failure,
},
{
handler: redirectHandler(http.StatusFound, false), // 302
health: probe.Success,
},
{
handler: redirectHandler(http.StatusFound, true), // 302
health: probe.Failure,
},
{
handler: redirectHandler(http.StatusTemporaryRedirect, false), // 307
health: probe.Success,
},
{
handler: redirectHandler(http.StatusTemporaryRedirect, true), // 307
health: probe.Failure,
},
{
handler: redirectHandler(http.StatusPermanentRedirect, false), // 308
health: probe.Success,
},
{
handler: redirectHandler(http.StatusPermanentRedirect, true), // 308
health: probe.Failure,
},
}
for i, test := range testCases {
func() {