Match GroupVersionKind against specific version

This commit is contained in:
Maciej Szulik
2016-10-04 14:00:47 +02:00
parent 1dc8277507
commit 69f751a2a4
3 changed files with 71 additions and 4 deletions

View File

@@ -602,12 +602,15 @@ func TestConvertToVersion(t *testing.T) {
gv: unversioned.GroupVersion{Version: "__internal"},
out: &TestType1{A: "test"},
},
// prefers the first group version in the list
// prefers the best match
{
scheme: GetTestScheme(),
in: &ExternalTestType1{A: "test"},
gv: unversioned.GroupVersions{{Version: "__internal"}, {Version: "v1"}},
out: &TestType1{A: "test"},
out: &ExternalTestType1{
MyWeirdCustomEmbeddedVersionKindField: MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
A: "test",
},
},
// unversioned type returned as-is
{