Merge pull request #61354 from schylek/master

Automatic merge from submit-queue (batch tested with PRs 61354, 61366, 61386, 61394, 60755). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

vendor: Update github.com/evanphx/json-patch

Updates github.com/evanphx/json-patch dependency
to fix handling tests against empty objects/arrays.

Includes fix from evanphx/json-patch#50

Kubernetes-commit: 18a7ea703bdf09f1ff0b83e15b3febf49a447a24
This commit is contained in:
Kubernetes Publisher 2018-03-21 23:44:07 -07:00
commit bd919879bd
2 changed files with 76 additions and 56 deletions

112
Godeps/Godeps.json generated
View File

@ -372,7 +372,7 @@
}, },
{ {
"ImportPath": "github.com/evanphx/json-patch", "ImportPath": "github.com/evanphx/json-patch",
"Rev": "944e07253867aacae43c04b2e6a239005443f33a" "Rev": "ed7cfbae1fffc071f71e068df27bf4f0521402d8"
}, },
{ {
"ImportPath": "github.com/ghodss/yaml", "ImportPath": "github.com/ghodss/yaml",
@ -932,223 +932,223 @@
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/equality", "ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/errors", "ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/meta", "ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/resource", "ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing", "ImportPath": "k8s.io/apimachinery/pkg/api/testing",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip", "ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/validation", "ImportPath": "k8s.io/apimachinery/pkg/api/validation",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/validation/path", "ImportPath": "k8s.io/apimachinery/pkg/api/validation/path",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery", "ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced", "ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered", "ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/validation", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/validation",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion", "ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/fields", "ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/labels", "ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime", "ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/selection", "ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/types", "ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/cache", "ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/clock", "ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/diff", "ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/errors", "ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/framer", "ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr", "ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/json", "ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/net", "ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/rand", "ImportPath": "k8s.io/apimachinery/pkg/util/rand",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime", "ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/sets", "ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/uuid", "ImportPath": "k8s.io/apimachinery/pkg/util/uuid",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation", "ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/wait", "ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/waitgroup", "ImportPath": "k8s.io/apimachinery/pkg/util/waitgroup",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml", "ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/version", "ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/watch", "ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "3aa1cc99b23ea45d95fd4e1a648f10cc41a491e1" "Rev": "b94e5e603d6eb10ccb65a504f538ca1ae4ef92df"
}, },
{ {
"ImportPath": "k8s.io/client-go/discovery", "ImportPath": "k8s.io/client-go/discovery",

View File

@ -66,6 +66,10 @@ func (n *lazyNode) intoDoc() (*partialDoc, error) {
return &n.doc, nil return &n.doc, nil
} }
if n.raw == nil {
return nil, fmt.Errorf("Unable to unmarshal nil pointer as partial document")
}
err := json.Unmarshal(*n.raw, &n.doc) err := json.Unmarshal(*n.raw, &n.doc)
if err != nil { if err != nil {
@ -81,6 +85,10 @@ func (n *lazyNode) intoAry() (*partialArray, error) {
return &n.ary, nil return &n.ary, nil
} }
if n.raw == nil {
return nil, fmt.Errorf("Unable to unmarshal nil pointer as partial array")
}
err := json.Unmarshal(*n.raw, &n.ary) err := json.Unmarshal(*n.raw, &n.ary)
if err != nil { if err != nil {
@ -94,6 +102,10 @@ func (n *lazyNode) intoAry() (*partialArray, error) {
func (n *lazyNode) compact() []byte { func (n *lazyNode) compact() []byte {
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
if n.raw == nil {
return nil
}
err := json.Compact(buf, *n.raw) err := json.Compact(buf, *n.raw)
if err != nil { if err != nil {
@ -104,6 +116,10 @@ func (n *lazyNode) compact() []byte {
} }
func (n *lazyNode) tryDoc() bool { func (n *lazyNode) tryDoc() bool {
if n.raw == nil {
return false
}
err := json.Unmarshal(*n.raw, &n.doc) err := json.Unmarshal(*n.raw, &n.doc)
if err != nil { if err != nil {
@ -115,6 +131,10 @@ func (n *lazyNode) tryDoc() bool {
} }
func (n *lazyNode) tryAry() bool { func (n *lazyNode) tryAry() bool {
if n.raw == nil {
return false
}
err := json.Unmarshal(*n.raw, &n.ary) err := json.Unmarshal(*n.raw, &n.ary)
if err != nil { if err != nil {