From 2f1eefe6f1dc97cc3726697bf885eba4b72815db Mon Sep 17 00:00:00 2001 From: David Simansky Date: Thu, 21 Jul 2022 18:21:19 +0200 Subject: [PATCH] Add check for PVC status in E2E tests (#1707) * Add check for PVC status in E2E tests * Update test/e2e/service_test.go Co-authored-by: Gunjan Vyas Co-authored-by: Gunjan Vyas --- test/e2e/service_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/e2e/service_test.go b/test/e2e/service_test.go index f84a77a75..1d27a4663 100644 --- a/test/e2e/service_test.go +++ b/test/e2e/service_test.go @@ -240,11 +240,17 @@ func serviceCreateWithMount(r *test.KnRunResultCollector) { assert.NilError(r.T(), err) r.AssertNoError(out) - r.T().Log("update service with a new pvc mount") - out = r.KnTest().Kn().Run("service", "update", "test-svc", "--mount", "/mydir5=pvc:test-pvc") - r.AssertNoError(out) + _, err = kubectl.Run("wait", "--for='jsonpath={..status.phase}'=Bound", "pvc/test-pvc", "--timeout=30s") + if err == nil { + r.T().Log("update service with a new pvc mount") + out = r.KnTest().Kn().Run("service", "update", "test-svc", "--mount", "/mydir5=pvc:test-pvc") + r.AssertNoError(out) + + serviceDescribeMount(r, "test-svc", "/mydir", "key") + } else { + r.T().Log("PVC test skip due to unsatisfied PVC") + } - serviceDescribeMount(r, "test-svc", "/mydir", "key") } func getVolumeMountWithHostPath(svc *servingv1.Service, hostPath string) *v1.VolumeMount {