Add e2e tests

This commit is contained in:
Manuel de Brito Fontes 2017-10-17 19:50:27 -03:00
parent 99a355f25d
commit 601fb7dacf
1163 changed files with 289217 additions and 14195 deletions

2
vendor/k8s.io/client-go/rest/BUILD generated vendored
View file

@ -16,6 +16,7 @@ go_test(
"url_utils_test.go",
"urlbackoff_test.go",
],
importpath = "k8s.io/client-go/rest",
library = ":go_default_library",
deps = [
"//vendor/github.com/google/gofuzz:go_default_library",
@ -56,6 +57,7 @@ go_library(
"versions.go",
"zz_generated.deepcopy.go",
],
importpath = "k8s.io/client-go/rest",
deps = [
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/golang.org/x/net/http2:go_default_library",

View file

@ -823,6 +823,23 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu
}
}
// truncateBody decides if the body should be truncated, based on the glog Verbosity.
func truncateBody(body string) string {
max := 0
switch {
case bool(glog.V(9)):
max = 10240
case bool(glog.V(8)):
max = 1024
}
if len(body) <= max {
return body
}
return body[:max] + fmt.Sprintf(" [truncated %d chars]", len(body)-max)
}
// glogBody logs a body output that could be either JSON or protobuf. It explicitly guards against
// allocating a new string for the body output unless necessary. Uses a simple heuristic to determine
// whether the body is printable.
@ -831,9 +848,9 @@ func glogBody(prefix string, body []byte) {
if bytes.IndexFunc(body, func(r rune) bool {
return r < 0x0a
}) != -1 {
glog.Infof("%s:\n%s", prefix, hex.Dump(body))
glog.Infof("%s:\n%s", prefix, truncateBody(hex.Dump(body)))
} else {
glog.Infof("%s: %s", prefix, string(body))
glog.Infof("%s: %s", prefix, truncateBody(string(body)))
}
}
}

View file

@ -12,6 +12,7 @@ go_library(
"decoder.go",
"encoder.go",
],
importpath = "k8s.io/client-go/rest/watch",
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
@ -26,6 +27,7 @@ go_test(
"decoder_test.go",
"encoder_test.go",
],
importpath = "k8s.io/client-go/rest/watch_test",
deps = [
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library",