From c12a0ac731afb115dd2f2632481185c71562a906 Mon Sep 17 00:00:00 2001 From: Ming Date: Tue, 16 May 2023 03:33:51 +0000 Subject: [PATCH] Adjust Sleep time in E2E Signed-off-by: Ming --- test/e2e/backups/ttl.go | 2 +- test/e2e/migration/migration.go | 2 +- test/e2e/test/test.go | 2 +- test/e2e/util/k8s/namespace.go | 8 +++++++- test/e2e/util/kibishii/kibishii_utils.go | 4 ++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/test/e2e/backups/ttl.go b/test/e2e/backups/ttl.go index 92a563199..09afb23e8 100644 --- a/test/e2e/backups/ttl.go +++ b/test/e2e/backups/ttl.go @@ -51,7 +51,7 @@ func (b *TTL) Init() { b.testNS = "backup-ttl-test-" + UUIDgen.String() b.backupName = "backup-ttl-test-" + UUIDgen.String() b.restoreName = "restore-ttl-test-" + UUIDgen.String() - b.ttl = 20 * time.Minute + b.ttl = 10 * time.Minute } diff --git a/test/e2e/migration/migration.go b/test/e2e/migration/migration.go index 481d52a95..c9b7571a6 100644 --- a/test/e2e/migration/migration.go +++ b/test/e2e/migration/migration.go @@ -226,7 +226,7 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version) // the snapshots of AWS may be still in pending status when do the restore, wait for a while // to avoid this https://github.com/vmware-tanzu/velero/issues/1799 // TODO remove this after https://github.com/vmware-tanzu/velero/issues/3533 is fixed - if (veleroCfg.CloudProvider == "aws" || veleroCfg.CloudProvider == "vsphere") && useVolumeSnapshots { + if veleroCfg.CloudProvider == "aws" && useVolumeSnapshots { fmt.Println("Waiting 5 minutes to make sure the snapshots are ready...") time.Sleep(5 * time.Minute) } diff --git a/test/e2e/test/test.go b/test/e2e/test/test.go index 160444126..259484bd4 100644 --- a/test/e2e/test/test.go +++ b/test/e2e/test/test.go @@ -196,7 +196,7 @@ func (t *TestCase) Restore() error { // the snapshots of AWS may be still in pending status when do the restore, wait for a while // to avoid this https://github.com/vmware-tanzu/velero/issues/1799 // TODO remove this after https://github.com/vmware-tanzu/velero/issues/3533 is fixed - if t.UseVolumeSnapshots { + if t.UseVolumeSnapshots && veleroCfg.CloudProvider != "vsphere" { fmt.Println("Waiting 5 minutes to make sure the snapshots are ready...") time.Sleep(5 * time.Minute) } diff --git a/test/e2e/util/k8s/namespace.go b/test/e2e/util/k8s/namespace.go index d04f4e456..c74f8e293 100644 --- a/test/e2e/util/k8s/namespace.go +++ b/test/e2e/util/k8s/namespace.go @@ -69,7 +69,13 @@ func GetNamespace(ctx context.Context, client TestClient, namespace string) (*co func DeleteNamespace(ctx context.Context, client TestClient, namespace string, wait bool) error { tenMinuteTimeout, ctxCancel := context.WithTimeout(context.Background(), time.Minute*10) defer ctxCancel() - if err := client.ClientGo.CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{}); err != nil { + + var zero int64 = 0 + policy := metav1.DeletePropagationForeground + if err := client.ClientGo.CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{ + GracePeriodSeconds: &zero, + PropagationPolicy: &policy, + }); err != nil { return errors.Wrap(err, fmt.Sprintf("failed to delete the namespace %q", namespace)) } if !wait { diff --git a/test/e2e/util/kibishii/kibishii_utils.go b/test/e2e/util/kibishii/kibishii_utils.go index e177a2c37..66ad2116d 100644 --- a/test/e2e/util/kibishii/kibishii_utils.go +++ b/test/e2e/util/kibishii/kibishii_utils.go @@ -179,7 +179,7 @@ func RunKibishiiTests(veleroCfg VeleroConfig, backupName, restoreName, backupLoc RunDebug(context.Background(), veleroCLI, veleroNamespace, "", restoreName) return errors.Wrapf(err, "Restore %s failed from backup %s", restoreName, backupName) } - if !useVolumeSnapshots { + if !useVolumeSnapshots && providerName != "vsphere" { pvrs, err := GetPVR(oneHourTimeout, veleroCfg.VeleroNamespace, kibishiiNamespace) if err != nil { return errors.Wrapf(err, "failed to get PVR for namespace %s", kibishiiNamespace) @@ -323,7 +323,7 @@ func KibishiiVerifyAfterRestore(client TestClient, kibishiiNamespace string, one if err := waitForKibishiiPods(oneHourTimeout, client, kibishiiNamespace); err != nil { return errors.Wrapf(err, "Failed to wait for ready status of kibishii pods in %s", kibishiiNamespace) } - time.Sleep(60 * time.Second) + // TODO - check that namespace exists fmt.Printf("running kibishii verify\n") if err := verifyData(oneHourTimeout, kibishiiNamespace, kibishiiData); err != nil {