@@ -138,6 +138,20 @@ var role = &unstructured.Unstructured{
138
138
},
139
139
}
140
140
141
+ var unknownCR = & unstructured.Unstructured {
142
+ Object : map [string ]interface {}{
143
+ "apiVersion" : "cli-utils.test/v1" ,
144
+ "kind" : "Unknown" ,
145
+ "metadata" : map [string ]interface {}{
146
+ "name" : "test" ,
147
+ "namespace" : "default" ,
148
+ "annotations" : map [string ]interface {}{
149
+ "config.k8s.io/owning-inventory" : testInventoryLabel ,
150
+ },
151
+ },
152
+ },
153
+ }
154
+
141
155
// Returns a inventory object with the inventory set from
142
156
// the passed "children".
143
157
func createInventoryInfo (children ... * unstructured.Unstructured ) inventory.InventoryInfo {
@@ -231,6 +245,13 @@ func TestPrune(t *testing.T) {
231
245
finalClusterObjs : []* unstructured.Unstructured {namespace , pod },
232
246
pruneEventObjs : []* unstructured.Unstructured {pdb , namespace },
233
247
},
248
+ "unknown type doesn't emit prune failed event" : {
249
+ pastObjs : []* unstructured.Unstructured {unknownCR },
250
+ currentObjs : []* unstructured.Unstructured {},
251
+ prunedObjs : []* unstructured.Unstructured {unknownCR },
252
+ finalClusterObjs : []* unstructured.Unstructured {},
253
+ pruneEventObjs : []* unstructured.Unstructured {},
254
+ },
234
255
}
235
256
for name , tc := range tests {
236
257
for i := range common .Strategies {
0 commit comments