Unversioned types should decode no matter what the requested version is

Status is exposed as v1 in the current schema (so all groups are
returning v1.Status).  However, if you give a codec only "mygroup"
"myversion", it will fail to convert Status to v1. For now, unversioned
types should be allowed to be projected into all group versions, and
when we add the server group we'll rip out the unversioned concept
entirely.
This commit is contained in:
Clayton Coleman
2016-11-01 21:37:13 -04:00
parent 95116c776e
commit 051382687d
2 changed files with 20 additions and 0 deletions

View File

@@ -625,6 +625,17 @@ func TestConvertToVersion(t *testing.T) {
A: "test",
},
},
// unversioned type returned when not included in the target types
{
scheme: GetTestScheme(),
in: &UnversionedType{A: "test"},
gv: unversioned.GroupVersions{{Group: "other", Version: "v2"}},
same: true,
out: &UnversionedType{
MyWeirdCustomEmbeddedVersionKindField: MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "UnversionedType"},
A: "test",
},
},
// detected as already being in the target version
{
scheme: GetTestScheme(),