forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix expectations in disruptionbudget controller
* Satisfy delete expectation when recreating VMIs (they were not satisfied and VMIs got no new PDB when recreating it). * Don't recreate PDBs for VMIs which are already marked for deletion (when scling VMIs down, PDBs got deleted and recreated until they eventually converged). * Don't write an error log message if VMIs which are not managed by VMs are encountered by the VM controller
- Loading branch information
Showing
4 changed files
with
88 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -963,6 +963,34 @@ var _ = Describe("[rfe_id:393][crit:high[vendor:[email protected]][level:system] | |
Expect(errors.IsTooManyRequests(err)).To(BeTrue()) | ||
}) | ||
|
||
It("should recreate the PDB if VMIs with similar names are recreated", func() { | ||
for x := 0; x < 3; x++ { | ||
By("creating the VMI") | ||
_, err := virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
By("checking that the PDB appeared") | ||
Eventually(func() []v1beta1.PodDisruptionBudget { | ||
pdbs, err := virtClient.PolicyV1beta1().PodDisruptionBudgets(tests.NamespaceTestDefault).List(metav1.ListOptions{}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
return pdbs.Items | ||
}, 3*time.Second, 500*time.Millisecond).Should(HaveLen(1)) | ||
By("deleting the VMI") | ||
err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Delete(vmi.Name, &metav1.DeleteOptions{}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
By("checking that the PDB disappeared") | ||
Eventually(func() []v1beta1.PodDisruptionBudget { | ||
pdbs, err := virtClient.PolicyV1beta1().PodDisruptionBudgets(tests.NamespaceTestDefault).List(metav1.ListOptions{}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
return pdbs.Items | ||
}, 3*time.Second, 500*time.Millisecond).Should(HaveLen(0)) | ||
Eventually(func() bool { | ||
_, err := virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Get(vmi.Name, &metav1.GetOptions{}) | ||
return errors.IsNotFound(err) | ||
}, 30*time.Second, 500*time.Millisecond).Should(BeTrue()) | ||
} | ||
}) | ||
|
||
It("should block the eviction api while a slow migration is in progress", func() { | ||
vmi = fedoraVMIWithEvictionStrategy() | ||
|
||
|