@@ -138,6 +138,20 @@ var role = &unstructured.Unstructured{
138138 },
139139}
140140
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+
141155// Returns a inventory object with the inventory set from
142156// the passed "children".
143157func createInventoryInfo (children ... * unstructured.Unstructured ) inventory.InventoryInfo {
@@ -231,6 +245,13 @@ func TestPrune(t *testing.T) {
231245 finalClusterObjs : []* unstructured.Unstructured {namespace , pod },
232246 pruneEventObjs : []* unstructured.Unstructured {pdb , namespace },
233247 },
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+ },
234255 }
235256 for name , tc := range tests {
236257 for i := range common .Strategies {
0 commit comments