@@ -21,6 +21,7 @@ import (
21
21
. "github.com/onsi/gomega"
22
22
23
23
corev1 "k8s.io/api/core/v1"
24
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24
25
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
25
26
"k8s.io/apimachinery/pkg/runtime"
26
27
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -55,7 +56,21 @@ var _ = Describe("ip.objectTypeForListObject", func() {
55
56
referenceUnstructured := & unstructured.Unstructured {}
56
57
referenceUnstructured .SetGroupVersionKind (* gvk )
57
58
Expect (obj ).To (Equal (referenceUnstructured ))
59
+ })
60
+
61
+ It ("should find the object type for partial object metadata lists" , func () {
62
+ partialList := & metav1.PartialObjectMetadataList {}
63
+ partialList .APIVersion = ("v1" )
64
+ partialList .Kind = "PodList"
58
65
66
+ gvk , obj , err := ip .objectTypeForListObject (partialList )
67
+ Expect (err ).ToNot (HaveOccurred ())
68
+ Expect (gvk .Group ).To (Equal ("" ))
69
+ Expect (gvk .Version ).To (Equal ("v1" ))
70
+ Expect (gvk .Kind ).To (Equal ("Pod" ))
71
+ referencePartial := & metav1.PartialObjectMetadata {}
72
+ referencePartial .SetGroupVersionKind (* gvk )
73
+ Expect (obj ).To (Equal (referencePartial ))
59
74
})
60
75
61
76
It ("should find the object type of a list with a slice of literals items field" , func () {
@@ -64,9 +79,8 @@ var _ = Describe("ip.objectTypeForListObject", func() {
64
79
Expect (gvk .Group ).To (Equal ("" ))
65
80
Expect (gvk .Version ).To (Equal ("v1" ))
66
81
Expect (gvk .Kind ).To (Equal ("Pod" ))
67
- var referencePod * corev1.Pod
82
+ referencePod := & corev1.Pod {}
68
83
Expect (obj ).To (Equal (referencePod ))
69
-
70
84
})
71
85
72
86
It ("should find the object type of a list with a slice of pointers items field" , func () {
@@ -88,7 +102,7 @@ var _ = Describe("ip.objectTypeForListObject", func() {
88
102
Expect (gvk .Group ).To (Equal (itemPointerSliceTypeGroupName ))
89
103
Expect (gvk .Version ).To (Equal (itemPointerSliceTypeVersion ))
90
104
Expect (gvk .Kind ).To (Equal ("UnconventionalListType" ))
91
- var referenceObject * controllertest.UnconventionalListType
105
+ referenceObject := & controllertest.UnconventionalListType {}
92
106
Expect (obj ).To (Equal (referenceObject ))
93
107
})
94
108
})
0 commit comments