Fix flaky DataImportCron volume snapshot test (#3583)

As commented by Alex Kalenyuk: the condition check flakes because the
switch to snapshot boot sources is almost instant. The DataImportCron
never becomes "not ready" following the switch. We also moved the DIC
"ready" check after the snapshot "ready" check, otherwise we may check
it before it's "not ready", which checks nothing.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
Co-authored-by: Arnon Gilboa <agilboa@redhat.com>
This commit is contained in:
kubevirt-bot 2025-01-06 18:52:24 +01:00 committed by GitHub
parent 1b826b0b28
commit da1c19776b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -714,11 +714,9 @@ var _ = Describe("DataImportCron", func() {
// Now simulate an upgrade, where a new CDI version has identified
// more storage types that scale better with snapshots
configureStorageProfileResultingFormat(cdiv1.DataImportCronSourceFormatSnapshot)
// Switches to not ready because the snapshot wasn't created yet
waitForConditions(corev1.ConditionFalse, corev1.ConditionFalse)
waitForConditions(corev1.ConditionFalse, corev1.ConditionTrue)
// Check snapshot now exists and PVC is gone
currentSource := verifySourceReady(cdiv1.DataImportCronSourceFormatSnapshot, currentImportDv)
waitForConditions(corev1.ConditionFalse, corev1.ConditionTrue)
// DataSource is updated to point to a snapshot
dataSource, err := f.CdiClient.CdiV1beta1().DataSources(ns).Get(context.TODO(), cron.Spec.ManagedDataSource, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())