From b83dc9a7d9da365f8a1939e827c70b112de17f92 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Wed, 3 Apr 2019 12:12:11 -0400 Subject: [PATCH] Fake ObjectReaction should handle PartialObjectMetadata special When a client requests a PartialObjectMetadata returned from the ObjectReaction type, if the object has a GVK set use that instead of what the schema returns, since the majority of clients getting partial object metadata will be doing so using the metadata client or server side conversion. Kubernetes-commit: baf091e9dbad00db39e246815f9d7a21d148044f --- testing/fixture.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testing/fixture.go b/testing/fixture.go index b3ace307..98f82326 100644 --- a/testing/fixture.go +++ b/testing/fixture.go @@ -318,6 +318,11 @@ func (t *tracker) Add(obj runtime.Object) error { if err != nil { return err } + + if partial, ok := obj.(*metav1.PartialObjectMetadata); ok && len(partial.TypeMeta.APIVersion) > 0 { + gvks = []schema.GroupVersionKind{partial.TypeMeta.GroupVersionKind()} + } + if len(gvks) == 0 { return fmt.Errorf("no registered kinds for %v", obj) }