Fix pdb unit tests so recorder will validate Event object parsing
@@ -96,6 +96,7 @@ var _ = Describe("Disruptionbudget", func() {
vmimInformer, _ = testutils.NewFakeInformerFor(&v1.VirtualMachineInstanceMigration{})
podInformer, _ = testutils.NewFakeInformerFor(&v12.Pod{})
recorder = record.NewFakeRecorder(100)
+ recorder.IncludeObject = true
controller = disruptionbudget.NewDisruptionBudgetController(vmiInformer, pdbInformer, podInformer, vmimInformer, recorder, virtClient)
mockQueue = testutils.NewMockWorkQueue(controller.Queue)
@@ -164,6 +165,17 @@ var _ = Describe("Disruptionbudget", func() {
testutils.ExpectEvent(recorder, disruptionbudget.SuccessfulDeletePodDisruptionBudgetReason)
})
+ It("should remove the pdb if VMI doesn't exist", func() {
+ vmi := newVirtualMachine()
+ vmi.Spec.EvictionStrategy = newEvictionStrategy()
+ pdb := newPodDisruptionBudget(vmi)
+ pdbFeeder.Add(pdb)
+
+ shouldExpectPDBDeletion(pdb)
+ controller.Execute()
+ testutils.ExpectEvent(recorder, disruptionbudget.SuccessfulDeletePodDisruptionBudgetReason)
+ })
+
It("should recreate the PDB if the VMI is recreated", func() {
vmi := newVirtualMachine()
vmi.Spec.EvictionStrategy = newEvictionStrategy()
