register internal types with scheme for reference unit test

This commit is contained in:
Jordan Liggitt 2016-03-12 19:06:20 -05:00
parent c9250bba2a
commit 3594370cfe

View File

@ -36,6 +36,14 @@ type ExtensionAPIObject struct {
func (obj *ExtensionAPIObject) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func TestGetReference(t *testing.T) {
// when vendoring kube, if you don't force the set of registered versions (like this hack/test-go.sh does)
// then you run into trouble because the types aren't registered in the scheme by anything. This does the
// register manually to allow unit test execution
if _, err := Scheme.ObjectKind(&Pod{}); err != nil {
AddToScheme(Scheme)
}
table := map[string]struct {
obj runtime.Object
ref *ObjectReference