diff --git a/pkg/apiserver/webhooks/datavolume-validate_test.go b/pkg/apiserver/webhooks/datavolume-validate_test.go index d21fcd2ea4..b39e5e67ee 100644 --- a/pkg/apiserver/webhooks/datavolume-validate_test.go +++ b/pkg/apiserver/webhooks/datavolume-validate_test.go @@ -265,7 +265,7 @@ var _ = Describe("Validating Webhook", func() { Expect(resp.Allowed).To(BeTrue()) }) - It("should accept DataVolume with unbound PVC and adoption featurgate set", func() { + It("should reject DataVolume with unbound PVC and adoption featurgate set", func() { dataVolume := newHTTPDataVolume("testDV", "http://www.example.com") pvc := &corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ diff --git a/tests/framework/pvc.go b/tests/framework/pvc.go index 338b8cb7a7..4df050059b 100644 --- a/tests/framework/pvc.go +++ b/tests/framework/pvc.go @@ -39,6 +39,10 @@ func (f *Framework) CreateBoundPVCFromDefinition(def *k8sv1.PersistentVolumeClai gomega.Expect(err).ToNot(gomega.HaveOccurred()) f.ForceBindIfWaitForFirstConsumer(pvc) + err = utils.WaitForPersistentVolumeClaimPhase(f.K8sClient, pvc.Namespace, k8sv1.ClaimBound, pvc.Name) + gomega.Expect(err).ToNot(gomega.HaveOccurred()) + pvc, err = utils.FindPVC(f.K8sClient, pvc.Namespace, pvc.Name) + gomega.Expect(err).ToNot(gomega.HaveOccurred()) return pvc } diff --git a/tests/upload_test.go b/tests/upload_test.go index 14dfe2ff81..ff0e792826 100644 --- a/tests/upload_test.go +++ b/tests/upload_test.go @@ -958,6 +958,10 @@ var _ = Describe("Block PV upload Test", Serial, func() { f := framework.NewFramework(namespacePrefix) BeforeEach(func() { + if !f.IsBlockVolumeStorageClassAvailable() { + Skip("Storage Class for block volume is not available") + } + if pvc != nil { Eventually(func() bool { // Make sure the pvc doesn't still exist. The after each should have called delete. @@ -995,10 +999,6 @@ var _ = Describe("Block PV upload Test", Serial, func() { }) DescribeTable("should", func(validToken bool, expectedStatus int) { - if !f.IsBlockVolumeStorageClassAvailable() { - Skip("Storage Class for block volume is not available") - } - By("Verify PVC annotation says ready") found, err := utils.WaitPVCPodStatusReady(f.K8sClient, pvc) Expect(err).ToNot(HaveOccurred())