Commit a6dafe40 authored by Mike Bryant's avatar Mike Bryant

Use correct variable in thirdpartyresourcedata codec.

Fixes #34459
parent e72f26a3
...@@ -418,7 +418,7 @@ func (t *thirdPartyResourceDataDecoder) Decode(data []byte, gvk *unversioned.Gro ...@@ -418,7 +418,7 @@ func (t *thirdPartyResourceDataDecoder) Decode(data []byte, gvk *unversioned.Gro
return nil, nil, fmt.Errorf("unexpected object for 'kind': %v", kindObj) return nil, nil, fmt.Errorf("unexpected object for 'kind': %v", kindObj)
} }
if len(t.kind) > 0 && kindStr != t.kind { if len(t.kind) > 0 && kindStr != t.kind {
return nil, nil, fmt.Errorf("kind doesn't match, expecting: %s, got %s", gvk.Kind, kindStr) return nil, nil, fmt.Errorf("kind doesn't match, expecting: %s, got %s", t.kind, kindStr)
} }
actual.Kind = kindStr actual.Kind = kindStr
} }
......
...@@ -81,6 +81,15 @@ func TestCodec(t *testing.T) { ...@@ -81,6 +81,15 @@ func TestCodec(t *testing.T) {
name: "basic", name: "basic",
}, },
{ {
into: &extensions.ThirdPartyResourceData{},
obj: &Foo{
ObjectMeta: api.ObjectMeta{Name: "bar"},
TypeMeta: unversioned.TypeMeta{Kind: "ThirdPartyResourceData"},
},
expectErr: true,
name: "broken kind",
},
{
obj: &Foo{ obj: &Foo{
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "baz"}, ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "baz"},
TypeMeta: unversioned.TypeMeta{APIVersion: "company.com/v1", Kind: "Foo"}, TypeMeta: unversioned.TypeMeta{APIVersion: "company.com/v1", Kind: "Foo"},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment