@@ -24,6 +24,7 @@ import (
24
24
25
25
v1 "k8s.io/api/core/v1"
26
26
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
27
28
"k8s.io/apimachinery/pkg/runtime"
28
29
"k8s.io/utils/ptr"
29
30
)
@@ -78,6 +79,43 @@ func TestCheckListFromCacheDataConsistencyIfRequestedInternalHappyPath(t *testin
78
79
TimeoutSeconds : ptr .To (int64 (39 )),
79
80
},
80
81
},
82
+ {
83
+ name : "list detector works with a unstructured list" ,
84
+ listResponse : & unstructured.UnstructuredList {
85
+ Object : map [string ]interface {}{
86
+ "apiVersion" : "vTest" ,
87
+ "kind" : "rTestList" ,
88
+ "metadata" : map [string ]interface {}{
89
+ "resourceVersion" : "3" ,
90
+ },
91
+ },
92
+ Items : []unstructured.Unstructured {
93
+ * makeUnstructuredObject ("vTest" , "rTest" , "item1" ),
94
+ * makeUnstructuredObject ("vTest" , "rTest" , "item2" ),
95
+ * makeUnstructuredObject ("vTest" , "rTest" , "item3" ),
96
+ },
97
+ },
98
+ retrievedListOptions : metav1.ListOptions {TimeoutSeconds : ptr .To (int64 (39 ))},
99
+ retrievedList : & unstructured.UnstructuredList {
100
+ Object : map [string ]interface {}{
101
+ "apiVersion" : "vTest" ,
102
+ "kind" : "rTestList" ,
103
+ "metadata" : map [string ]interface {}{
104
+ "resourceVersion" : "3" ,
105
+ },
106
+ },
107
+ Items : []unstructured.Unstructured {
108
+ * makeUnstructuredObject ("vTest" , "rTest" , "item1" ),
109
+ * makeUnstructuredObject ("vTest" , "rTest" , "item2" ),
110
+ * makeUnstructuredObject ("vTest" , "rTest" , "item3" ),
111
+ },
112
+ },
113
+ expectedRequestOptions : metav1.ListOptions {
114
+ ResourceVersion : "3" ,
115
+ ResourceVersionMatch : metav1 .ResourceVersionMatchExact ,
116
+ TimeoutSeconds : ptr .To (int64 (39 )),
117
+ },
118
+ },
81
119
}
82
120
for _ , scenario := range scenarios {
83
121
t .Run (scenario .name , func (t * testing.T ) {
0 commit comments