From eea879bac2810fcc7cd4f4985fb658aad5a5c122 Mon Sep 17 00:00:00 2001 From: Aishwarya-Hebbar Date: Fri, 6 Sep 2024 15:39:07 +0530 Subject: [PATCH] Storage quota changes in supervisor for policy driven allocation tests --- tests/e2e/policy_driven_vol_allocation.go | 12 ++++++++++-- tests/e2e/util.go | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/e2e/policy_driven_vol_allocation.go b/tests/e2e/policy_driven_vol_allocation.go index bc0a803b52..0904fed4cc 100644 --- a/tests/e2e/policy_driven_vol_allocation.go +++ b/tests/e2e/policy_driven_vol_allocation.go @@ -268,9 +268,17 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } else if guestCluster { _, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(client, ctx, svNamespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } for i, policyName := range policyNames { @@ -285,7 +293,7 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } else if supervisorCluster { ginkgo.By("CNS_TEST: Running for WCP setup") // create resource quota - createResourceQuota(client, namespace, rqLimit, policyName) + //createResourceQuota(client, namespace, rqLimit, policyName) if wcpVsanDirectCluster { storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) @@ -302,7 +310,7 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } } else { ginkgo.By("CNS_TEST: Running for GC setup") - createResourceQuota(client, namespace, rqLimit, policyName) + //createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) pvclaim, err = createPVC(ctx, client, namespace, nil, "", storageclass, "") diff --git a/tests/e2e/util.go b/tests/e2e/util.go index 4a16536ca0..74b4d26398 100644 --- a/tests/e2e/util.go +++ b/tests/e2e/util.go @@ -7009,6 +7009,7 @@ func removeStoragePolicyQuota(ctx context.Context, restClientConfig *rest.Config gomega.Expect(err).NotTo(gomega.HaveOccurred()) spq := &storagepolicyv1alpha2.StoragePolicyQuota{} + time.Sleep(7 * time.Minute) err = cnsOperatorClient.Get(ctx, pkgtypes.NamespacedName{Name: scName + storagePolicyQuota, Namespace: namespace}, spq) gomega.Expect(err).NotTo(gomega.HaveOccurred())