Update go dependencies (#2234)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2018-03-23 13:35:19 -03:00 committed by GitHub
parent 6e099c5f57
commit 93c72ef646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1236 changed files with 37226 additions and 49844 deletions

View file

@ -12,8 +12,7 @@ go_test(
"cache_test.go",
"lruexpirecache_test.go",
],
importpath = "k8s.io/apimachinery/pkg/util/cache",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/golang/groupcache/lru:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/clock:go_default_library",

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["clock_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/clock",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["diff_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/diff",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["errors_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/errors",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -21,7 +21,7 @@ import (
"fmt"
)
// MessageCountMap contains occurance for each error message.
// MessageCountMap contains occurrence for each error message.
type MessageCountMap map[string]int
// Aggregate represents an object that contains multiple errors, but does not

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["framer_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/framer",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["httpstream_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/httpstream",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -13,8 +13,7 @@ go_test(
"roundtripper_test.go",
"upgrade_test.go",
],
importpath = "k8s.io/apimachinery/pkg/util/httpstream/spdy",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/elazarl/goproxy:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/httpstream:go_default_library",

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["intstr_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/intstr",
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//vendor/github.com/ghodss/yaml:go_default_library"],
)
@ -22,11 +21,9 @@ go_library(
],
importpath = "k8s.io/apimachinery/pkg/util/intstr",
deps = [
"//vendor/github.com/go-openapi/spec:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/google/gofuzz:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
],
)

View file

@ -24,9 +24,6 @@ import (
"strconv"
"strings"
openapi "k8s.io/kube-openapi/pkg/common"
"github.com/go-openapi/spec"
"github.com/golang/glog"
"github.com/google/gofuzz"
)
@ -120,16 +117,15 @@ func (intstr IntOrString) MarshalJSON() ([]byte, error) {
}
}
func (_ IntOrString) OpenAPIDefinition() openapi.OpenAPIDefinition {
return openapi.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "int-or-string",
},
},
}
}
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
func (_ IntOrString) OpenAPISchemaType() []string { return []string{"string"} }
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
func (_ IntOrString) OpenAPISchemaFormat() string { return "int-or-string" }
func (intstr *IntOrString) Fuzz(c fuzz.Continue) {
if intstr == nil {

View file

@ -15,8 +15,7 @@ go_library(
go_test(
name = "go_default_test",
srcs = ["json_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/json",
library = ":go_default_library",
embed = [":go_default_library"],
)
filegroup(

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["util_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/mergepatch",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -15,8 +15,7 @@ go_test(
"port_split_test.go",
"util_test.go",
],
importpath = "k8s.io/apimachinery/pkg/util/net",
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//vendor/github.com/spf13/pflag:go_default_library"],
)

View file

@ -623,7 +623,7 @@ func TestFailGettingIPv4Routes(t *testing.T) {
errStrFrag := "no such file"
_, err := v4File.extract()
if err == nil {
fmt.Errorf("Expected error trying to read non-existent v4 route file")
t.Errorf("Expected error trying to read non-existent v4 route file")
}
if !strings.Contains(err.Error(), errStrFrag) {
t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())
@ -638,7 +638,7 @@ func TestFailGettingIPv6Routes(t *testing.T) {
errStrFrag := "no such file"
_, err := v6File.extract()
if err == nil {
fmt.Errorf("Expected error trying to read non-existent v6 route file")
t.Errorf("Expected error trying to read non-existent v6 route file")
}
if !strings.Contains(err.Error(), errStrFrag) {
t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())
@ -653,7 +653,7 @@ func TestGetAllDefaultRoutesFailNoV4RouteFile(t *testing.T) {
errStrFrag := "no such file"
_, err := getAllDefaultRoutes()
if err == nil {
fmt.Errorf("Expected error trying to read non-existent v4 route file")
t.Errorf("Expected error trying to read non-existent v4 route file")
}
if !strings.Contains(err.Error(), errStrFrag) {
t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())

View file

@ -18,6 +18,8 @@ package net
import (
"net"
"net/url"
"os"
"reflect"
"syscall"
)
@ -38,8 +40,16 @@ func IPNetEqual(ipnet1, ipnet2 *net.IPNet) bool {
// Returns if the given err is "connection reset by peer" error.
func IsConnectionReset(err error) bool {
opErr, ok := err.(*net.OpError)
if ok && opErr.Err.Error() == syscall.ECONNRESET.Error() {
if urlErr, ok := err.(*url.Error); ok {
err = urlErr.Err
}
if opErr, ok := err.(*net.OpError); ok {
err = opErr.Err
}
if osErr, ok := err.(*os.SyscallError); ok {
err = osErr.Err
}
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ECONNRESET {
return true
}
return false

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["runtime_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/runtime",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -43,7 +43,7 @@ var PanicHandlers = []func(interface{}){logPanic}
// TODO: remove this function. We are switching to a world where it's safe for
// apiserver to panic, since it will be restarted by kubelet. At the beginning
// of the Kubernetes project, nothing was going to restart apiserver and so
// catching panics was important. But it's actually much simpler for montoring
// catching panics was important. But it's actually much simpler for monitoring
// software if we just exit when an unexpected panic happens.
func HandleCrash(additionalHandlers ...func(interface{})) {
if r := recover(); r != nil {

View file

@ -51,8 +51,7 @@ $(location //vendor/k8s.io/code-generator/cmd/set-gen) \
go_test(
name = "go_default_test",
srcs = ["set_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/sets",
library = ":go_default_library",
embed = [":go_default_library"],
)
filegroup(

View file

@ -13,8 +13,7 @@ go_test(
"testdata/swagger-merge-item.json",
"testdata/swagger-precision-item.json",
],
importpath = "k8s.io/apimachinery/pkg/util/strategicpatch",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/davecgh/go-spew/spew:go_default_library",
"//vendor/github.com/ghodss/yaml:go_default_library",

View file

@ -423,7 +423,7 @@ func normalizeElementOrder(patch, serverOnly, patchOrder, serverOrder []interfac
// scan from the place of last insertion in `right` to the end of `right`,
// the place is before the first item that is greater than the item we want to insert.
// example usage: using server-only items as left and patch items as right. We insert server-only items
// to patch list. We use the order of live object as record for comparision.
// to patch list. We use the order of live object as record for comparison.
func mergeSortedSlice(left, right, serverOrder []interface{}, mergeKey string, kind reflect.Kind) []interface{} {
// Returns if l is less than r, and if both have been found.
// If l and r both present and l is in front of r, l is less than r.
@ -1322,23 +1322,23 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
// If they're both maps or lists, recurse into the value.
switch originalType.Kind() {
case reflect.Map:
subschema, patchMeta, err := schema.LookupPatchMetadataForStruct(k)
if err != nil {
return nil, err
subschema, patchMeta, err2 := schema.LookupPatchMetadataForStruct(k)
if err2 != nil {
return nil, err2
}
_, patchStrategy, err := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
if err != nil {
return nil, err
_, patchStrategy, err2 := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
if err2 != nil {
return nil, err2
}
original[k], err = mergeMapHandler(original[k], patchV, subschema, patchStrategy, mergeOptions)
case reflect.Slice:
subschema, patchMeta, err := schema.LookupPatchMetadataForSlice(k)
if err != nil {
return nil, err
subschema, patchMeta, err2 := schema.LookupPatchMetadataForSlice(k)
if err2 != nil {
return nil, err2
}
_, patchStrategy, err := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
if err != nil {
return nil, err
_, patchStrategy, err2 := extractRetainKeysPatchStrategy(patchMeta.GetPatchStrategies())
if err2 != nil {
return nil, err2
}
original[k], err = mergeSliceHandler(original[k], patchV, subschema, patchStrategy, patchMeta.GetPatchMergeKey(), isDeleteList, mergeOptions)
default:
@ -2109,7 +2109,7 @@ func sliceTypeAssertion(original, patch interface{}) ([]interface{}, []interface
}
// extractRetainKeysPatchStrategy process patch strategy, which is a string may contains multiple
// patch strategies seperated by ",". It returns a boolean var indicating if it has
// patch strategies separated by ",". It returns a boolean var indicating if it has
// retainKeys strategies and a string for the other strategy.
func extractRetainKeysPatchStrategy(strategies []string) (bool, string, error) {
switch len(strategies) {

View file

@ -654,6 +654,21 @@ mergingIntList:
ExpectedError: "doesn't match",
},
},
{
Description: "missing merge key should error out",
StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
Original: []byte(`
mergingList:
- name: 1
value: a
`),
TwoWay: []byte(`
mergingList:
- value: b
`),
ExpectedError: "does not contain declared merge key",
},
},
}
func TestCustomStrategicMergePatch(t *testing.T) {

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["validation_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/validation",
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library"],
)

View file

@ -12,8 +12,7 @@ go_test(
"errors_test.go",
"path_test.go",
],
importpath = "k8s.io/apimachinery/pkg/util/validation/field",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -99,7 +99,7 @@ func TestErrorUsefulMessage(t *testing.T) {
"foo", ErrorTypeInvalid.String(),
"Baz", "Qux", "Inner", "KV", "detail",
"1", "aoeu", "Billy", "2",
// "asdf", TODO: reenable once we have a better nested printer
// "asdf", TODO: re-enable once we have a better nested printer
} {
if !strings.Contains(s, part) {
t.Errorf("error message did not contain expected part '%v'", part)

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["wait_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/wait",
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library"],
)

View file

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["decoder_test.go"],
importpath = "k8s.io/apimachinery/pkg/util/yaml",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View file

@ -122,12 +122,12 @@ func (d *YAMLDecoder) Read(data []byte) (n int, err error) {
if left <= len(data) {
copy(data, d.remaining)
d.remaining = nil
return len(d.remaining), nil
return left, nil
}
// caller will need to reread
copy(data, d.remaining[:left])
d.remaining = d.remaining[left:]
copy(data, d.remaining[:len(data)])
d.remaining = d.remaining[len(data):]
return len(data), io.ErrShortBuffer
}

View file

@ -22,12 +22,68 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math/rand"
"reflect"
"strings"
"testing"
)
func TestYAMLDecoderReadBytesLength(t *testing.T) {
d := `---
stuff: 1
test-foo: 1
`
testCases := []struct {
bufLen int
expectLen int
expectErr error
}{
{len(d), len(d), nil},
{len(d) + 10, len(d), nil},
{len(d) - 10, len(d) - 10, io.ErrShortBuffer},
}
for i, testCase := range testCases {
r := NewDocumentDecoder(ioutil.NopCloser(bytes.NewReader([]byte(d))))
b := make([]byte, testCase.bufLen)
n, err := r.Read(b)
if err != testCase.expectErr || n != testCase.expectLen {
t.Fatalf("%d: unexpected body: %d / %v", i, n, err)
}
}
}
func TestYAMLDecoderCallsAfterErrShortBufferRestOfFrame(t *testing.T) {
d := `---
stuff: 1
test-foo: 1`
r := NewDocumentDecoder(ioutil.NopCloser(bytes.NewReader([]byte(d))))
b := make([]byte, 12)
n, err := r.Read(b)
if err != io.ErrShortBuffer || n != 12 {
t.Fatalf("expected ErrShortBuffer: %d / %v", n, err)
}
expected := "---\nstuff: 1"
if string(b) != expected {
t.Fatalf("expected bytes read to be: %s got: %s", expected, string(b))
}
b = make([]byte, 13)
n, err = r.Read(b)
if err != nil || n != 13 {
t.Fatalf("expected nil: %d / %v", n, err)
}
expected = "\n\ttest-foo: 1"
if string(b) != expected {
t.Fatalf("expected bytes read to be: '%s' got: '%s'", expected, string(b))
}
b = make([]byte, 15)
n, err = r.Read(b)
if err != io.EOF || n != 0 {
t.Fatalf("expected EOF: %d / %v", n, err)
}
}
func TestSplitYAMLDocument(t *testing.T) {
testCases := []struct {
input string