Skip to content

Commit

Permalink
Increase DV state timeout for multiple clone tests (#991)
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Rolland <frolland@redhat.com>
  • Loading branch information
kubevirt-bot authored and awels committed Oct 14, 2019
1 parent e1d83df commit 96065fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/cloner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ var _ = Describe("Validate Data Volume should clone multiple clones in parallel"
dvs := []*cdiv1.DataVolume{targetDv1, targetDv2, targetDv3}
for _, dv := range dvs {
By("Waiting for clone to be completed")
err = utils.WaitForDataVolumePhase(f.CdiClient, f.Namespace.Name, cdiv1.Succeeded, dv.Name)
err = utils.WaitForDataVolumePhaseWithTimeout(f.CdiClient, f.Namespace.Name, cdiv1.Succeeded, dv.Name, 3*90*time.Second)
Expect(err).ToNot(HaveOccurred())
matchFile := filepath.Join(testBaseDir, "disk.img")
Expect(f.VerifyTargetPVCContentMD5(f.Namespace, utils.PersistentVolumeClaimFromDataVolume(dv), matchFile, md5sum[:32])).To(BeTrue())
Expand Down Expand Up @@ -354,7 +354,7 @@ var _ = Describe("Validate Data Volume should clone multiple clones in parallel"
dvs := []*cdiv1.DataVolume{targetDv1, targetDv2, targetDv3}
for _, dv := range dvs {
By("Waiting for clone to be completed")
err = utils.WaitForDataVolumePhase(f.CdiClient, f.Namespace.Name, cdiv1.Succeeded, dv.Name)
err = utils.WaitForDataVolumePhaseWithTimeout(f.CdiClient, f.Namespace.Name, cdiv1.Succeeded, dv.Name, 3*90*time.Second)
Expect(err).ToNot(HaveOccurred())
Expect(f.VerifyTargetPVCContentMD5(f.Namespace, utils.PersistentVolumeClaimFromDataVolume(dv), testBaseDir, md5sum[:32])).To(BeTrue())
_, err = utils.WaitPodDeleted(f.K8sClient, "verify-pvc-md5", f.Namespace.Name, verifyPodDeletedTimeout)
Expand Down
9 changes: 7 additions & 2 deletions tests/utils/datavolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,20 @@ func NewDataVolumeWithRegistryImport(dataVolumeName string, size string, registr

// WaitForDataVolumePhase waits for DV's phase to be in a particular phase (Pending, Bound, or Lost)
func WaitForDataVolumePhase(clientSet *cdiclientset.Clientset, namespace string, phase cdiv1.DataVolumePhase, dataVolumeName string) error {
err := wait.PollImmediate(dataVolumePollInterval, dataVolumePhaseTime, func() (bool, error) {
return WaitForDataVolumePhaseWithTimeout(clientSet, namespace, phase, dataVolumeName, dataVolumePhaseTime)
}

// WaitForDataVolumePhaseWithTimeout waits for DV's phase to be in a particular phase (Pending, Bound, or Lost) with a specified timeout
func WaitForDataVolumePhaseWithTimeout(clientSet *cdiclientset.Clientset, namespace string, phase cdiv1.DataVolumePhase, dataVolumeName string, timeout time.Duration) error {
err := wait.PollImmediate(dataVolumePollInterval, timeout, func() (bool, error) {
dataVolume, err := clientSet.CdiV1alpha1().DataVolumes(namespace).Get(dataVolumeName, metav1.GetOptions{})
if err != nil || dataVolume.Status.Phase != phase {
return false, err
}
return true, nil
})
if err != nil {
return fmt.Errorf("DataVolume %s not in phase %s within %v", dataVolumeName, phase, dataVolumePhaseTime)
return fmt.Errorf("DataVolume %s not in phase %s within %v", dataVolumeName, phase, timeout)
}
return nil
}
Expand Down

0 comments on commit 96065fc

Please sign in to comment.