From e13c9be88a96c01cc25090bfae177e70c1af8555 Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Fri, 26 Aug 2022 15:16:35 -0300 Subject: [PATCH] e2e: use custom timeouts in GetSnapshotContentFromSnapshot() --- test/e2e/storage/csi_mock_volume.go | 4 ++-- test/e2e/storage/framework/snapshot_resource.go | 2 +- test/e2e/storage/utils/snapshot.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e/storage/csi_mock_volume.go b/test/e2e/storage/csi_mock_volume.go index 795391dc2c4..8c4ed4a4c09 100644 --- a/test/e2e/storage/csi_mock_volume.go +++ b/test/e2e/storage/csi_mock_volume.go @@ -1528,7 +1528,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() { } ginkgo.By(fmt.Sprintf("Get VolumeSnapshotContent bound to VolumeSnapshot %s", snapshot.GetName())) - snapshotContent := utils.GetSnapshotContentFromSnapshot(m.config.Framework.DynamicClient, snapshot) + snapshotContent := utils.GetSnapshotContentFromSnapshot(m.config.Framework.DynamicClient, snapshot, f.Timeouts.SnapshotCreate) volumeSnapshotContentName := snapshotContent.GetName() ginkgo.By(fmt.Sprintf("Verify VolumeSnapshotContent %s contains finalizer %s", snapshot.GetName(), volumeSnapshotContentFinalizer)) @@ -1860,7 +1860,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() { _, snapshot := storageframework.CreateSnapshot(sDriver, m.config, storageframework.DynamicSnapshotDelete, pvc.Name, pvc.Namespace, f.Timeouts, parameters) framework.ExpectNoError(err, "failed to create snapshot") - snapshotcontent := utils.GetSnapshotContentFromSnapshot(m.config.Framework.DynamicClient, snapshot) + snapshotcontent := utils.GetSnapshotContentFromSnapshot(m.config.Framework.DynamicClient, snapshot, f.Timeouts.SnapshotCreate) if annotations, ok = snapshotcontent.Object["metadata"].(map[string]interface{})["annotations"]; !ok { framework.Failf("Unable to get volume snapshot content annotations") } diff --git a/test/e2e/storage/framework/snapshot_resource.go b/test/e2e/storage/framework/snapshot_resource.go index 57a6d55e664..7d80bd2ac4c 100644 --- a/test/e2e/storage/framework/snapshot_resource.go +++ b/test/e2e/storage/framework/snapshot_resource.go @@ -89,7 +89,7 @@ func CreateSnapshotResource(sDriver SnapshottableTestDriver, config *PerTestConf dc := r.Config.Framework.DynamicClient - r.Vscontent = utils.GetSnapshotContentFromSnapshot(dc, r.Vs) + r.Vscontent = utils.GetSnapshotContentFromSnapshot(dc, r.Vs, timeouts.SnapshotCreate) if pattern.SnapshotType == PreprovisionedCreatedSnapshot { // prepare a pre-provisioned VolumeSnapshotContent with certain data diff --git a/test/e2e/storage/utils/snapshot.go b/test/e2e/storage/utils/snapshot.go index 432ffdc2ff5..aff9e20efb3 100644 --- a/test/e2e/storage/utils/snapshot.go +++ b/test/e2e/storage/utils/snapshot.go @@ -80,9 +80,9 @@ func WaitForSnapshotReady(c dynamic.Interface, ns string, snapshotName string, p // GetSnapshotContentFromSnapshot returns the VolumeSnapshotContent object Bound to a // given VolumeSnapshot -func GetSnapshotContentFromSnapshot(dc dynamic.Interface, snapshot *unstructured.Unstructured) *unstructured.Unstructured { +func GetSnapshotContentFromSnapshot(dc dynamic.Interface, snapshot *unstructured.Unstructured, timeout time.Duration) *unstructured.Unstructured { defer ginkgo.GinkgoRecover() - err := WaitForSnapshotReady(dc, snapshot.GetNamespace(), snapshot.GetName(), framework.Poll, framework.SnapshotCreateTimeout) + err := WaitForSnapshotReady(dc, snapshot.GetNamespace(), snapshot.GetName(), framework.Poll, timeout) framework.ExpectNoError(err) vs, err := dc.Resource(SnapshotGVR).Namespace(snapshot.GetNamespace()).Get(context.TODO(), snapshot.GetName(), metav1.GetOptions{})