Skip to content

Commit a8cc837

Browse files
committed
++ wait for snapshots before checking for frozen filesystems
Signed-off-by: Ivan Mikheykin <[email protected]>
1 parent 5d3bb06 commit a8cc837

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

tests/e2e/vd_snapshots_test.go

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,28 @@ var _ = Describe("VirtualDiskSnapshots", ginkgoutil.CommonE2ETestDecorators(), f
282282
}
283283
})
284284

285+
It("checks snapshots", func() {
286+
By("Snapshots should be `Ready`")
287+
labels := make(map[string]string)
288+
maps.Copy(labels, attachedVirtualDiskLabel)
289+
maps.Copy(labels, testCaseLabel)
290+
291+
Eventually(func() error {
292+
vdSnapshots := GetVirtualDiskSnapshots(ns, labels)
293+
for _, snapshot := range vdSnapshots.Items {
294+
if snapshot.Status.Phase == virtv2.VirtualDiskSnapshotPhaseReady || snapshot.DeletionTimestamp != nil {
295+
continue
296+
}
297+
return errors.New("still wait for all snapshots either in ready or in deletion state")
298+
}
299+
return nil
300+
}).WithTimeout(
301+
LongWaitDuration,
302+
).WithPolling(
303+
Interval,
304+
).Should(Succeed(), "all snapshots should be in ready state after creation")
305+
})
306+
285307
// TODO: It is a known issue that disk snapshots are not always created consistently. To prevent this error from causing noise during testing, we disabled this check. It will need to be re-enabled once the consistency issue is fixed.
286308
// It("checks snapshots of attached VDs", func() {
287309
// By(fmt.Sprintf("Snapshots should be in %s phase", PhaseReady))
@@ -312,25 +334,6 @@ var _ = Describe("VirtualDiskSnapshots", ginkgoutil.CommonE2ETestDecorators(), f
312334
err := GetObjects(kc.ResourceVM, &vmObjects, kc.GetOptions{Namespace: ns})
313335
Expect(err).NotTo(HaveOccurred(), "cannot get virtual machines\nstderr: %s", err)
314336

315-
labels := make(map[string]string)
316-
maps.Copy(labels, attachedVirtualDiskLabel)
317-
maps.Copy(labels, testCaseLabel)
318-
319-
Eventually(func() error {
320-
vdSnapshots := GetVirtualDiskSnapshots(ns, labels)
321-
for _, snapshot := range vdSnapshots.Items {
322-
if snapshot.Status.Phase == virtv2.VirtualDiskSnapshotPhaseReady || snapshot.DeletionTimestamp != nil {
323-
continue
324-
}
325-
return errors.New("still wait for all snapshots either in ready or in deletion state")
326-
}
327-
return nil
328-
}).WithTimeout(
329-
LongWaitDuration,
330-
).WithPolling(
331-
Interval,
332-
).Should(Succeed(), "all snapshots should be in ready state after creation")
333-
334337
for _, vm := range vmObjects.Items {
335338
Eventually(func() error {
336339
frozen, err := CheckFileSystemFrozen(vm.Name, vm.Namespace)

0 commit comments

Comments
 (0)