From 701b5d7ecb75fe2da0d07fdf4be04496d46f99b8 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 19 Apr 2022 11:25:54 +0200 Subject: [PATCH] e2e: Add early return in Context() for disabled tests Some parts of the Context() seem to get executed, even when BeforeEach() did a Skip() for the test. By adding a return inside the Context(), the tests should not get executed at all. This was noticed in a failed test, where upgrade was running, eventhough the job was executed as a nornal non-upgrade one. Signed-off-by: Niels de Vos --- e2e/cephfs.go | 4 ++++ e2e/rbd.go | 4 ++++ e2e/upgrade-cephfs.go | 4 ++++ e2e/upgrade-rbd.go | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/e2e/cephfs.go b/e2e/cephfs.go index e7dc5a739..18dcffced 100644 --- a/e2e/cephfs.go +++ b/e2e/cephfs.go @@ -277,6 +277,10 @@ var _ = Describe("cephfs", func() { }) Context("Test CephFS CSI", func() { + if !testCephFS || upgradeTesting { + return + } + It("Test CephFS CSI", func() { pvcPath := cephFSExamplePath + "pvc.yaml" appPath := cephFSExamplePath + "pod.yaml" diff --git a/e2e/rbd.go b/e2e/rbd.go index f708ca5d7..08d90ba66 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -380,6 +380,10 @@ var _ = Describe("RBD", func() { }) Context("Test RBD CSI", func() { + if !testRBD || upgradeTesting { + return + } + It("Test RBD CSI", func() { // test only if ceph-csi is deployed via helm if helmTest { diff --git a/e2e/upgrade-cephfs.go b/e2e/upgrade-cephfs.go index 4bd2c36bf..d74ef1f3e 100644 --- a/e2e/upgrade-cephfs.go +++ b/e2e/upgrade-cephfs.go @@ -162,6 +162,10 @@ var _ = Describe("CephFS Upgrade Testing", func() { }) Context("Cephfs Upgrade Test", func() { + if !upgradeTesting || !testCephFS { + return + } + It("Cephfs Upgrade Test", func() { By("checking provisioner deployment is running", func() { err = waitForDeploymentComplete(f.ClientSet, cephFSDeploymentName, cephCSINamespace, deployTimeout) diff --git a/e2e/upgrade-rbd.go b/e2e/upgrade-rbd.go index 486fce7ed..0c62ceb03 100644 --- a/e2e/upgrade-rbd.go +++ b/e2e/upgrade-rbd.go @@ -176,6 +176,10 @@ var _ = Describe("RBD Upgrade Testing", func() { }) Context("Test RBD CSI", func() { + if !testRBD || !upgradeTesting { + return + } + It("Test RBD CSI", func() { pvcPath := rbdExamplePath + "pvc.yaml" appPath := rbdExamplePath + "pod.yaml"