From d3a8a397f9ed914b342fa813d5788d287eaece6a Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Fri, 3 Apr 2020 13:31:06 -0600 Subject: [PATCH] tests: skip upgrade test where csi is not supported The upgrade test requires the CSI driver to be running so we cannot run the test on older versions than k8s 1.13. Signed-off-by: Travis Nielsen (cherry picked from commit f90664209b7ac822034d658f182587ba11aaf990) --- tests/integration/ceph_base_block_test.go | 9 +++++---- tests/integration/ceph_base_file_test.go | 2 +- tests/integration/ceph_upgrade_test.go | 7 +++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/integration/ceph_base_block_test.go b/tests/integration/ceph_base_block_test.go index 592ad8783..24c742a2d 100644 --- a/tests/integration/ceph_base_block_test.go +++ b/tests/integration/ceph_base_block_test.go @@ -19,6 +19,7 @@ package integration import ( "fmt" "strconv" + "testing" "time" cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" @@ -36,17 +37,17 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -func checkSkipCSITest(s suite.Suite, k8sh *utils.K8sHelper) { +func checkSkipCSITest(t *testing.T, k8sh *utils.K8sHelper) { if !k8sh.VersionAtLeast("v1.13.0") { logger.Info("Skipping tests as kube version is less than 1.13.0 for the CSI driver") - s.T().Skip() + t.Skip() } } // Smoke Test for Block Storage - Test check the following operations on Block Storage in order // Create,Mount,Write,Read,Expand,Unmount and Delete. func runBlockCSITest(helper *clients.TestClient, k8sh *utils.K8sHelper, s suite.Suite, namespace string) { - checkSkipCSITest(s, k8sh) + checkSkipCSITest(s.T(), k8sh) podName := "block-test" poolName := "replicapool" @@ -196,7 +197,7 @@ func restartOSDPods(k8sh *utils.K8sHelper, s suite.Suite, namespace string) { } func runBlockCSITestLite(helper *clients.TestClient, k8sh *utils.K8sHelper, s suite.Suite, clusterNamespace, systemNamespace string, version cephv1.CephVersionSpec) { - checkSkipCSITest(s, k8sh) + checkSkipCSITest(s.T(), k8sh) logger.Infof("Block Storage End to End Integration Test - create storageclass,pool and pvc") logger.Infof("Running on Rook Cluster %s", clusterNamespace) diff --git a/tests/integration/ceph_base_file_test.go b/tests/integration/ceph_base_file_test.go index 78044c2ad..4b73a3cd3 100644 --- a/tests/integration/ceph_base_file_test.go +++ b/tests/integration/ceph_base_file_test.go @@ -44,7 +44,7 @@ const ( // Create,Mount,Write,Read,Unmount and Delete. func runFileE2ETest(helper *clients.TestClient, k8sh *utils.K8sHelper, s suite.Suite, namespace, filesystemName string, useCSI bool) { if useCSI { - checkSkipCSITest(s, k8sh) + checkSkipCSITest(s.T(), k8sh) } defer fileTestDataCleanUp(helper, k8sh, s, filePodName, namespace, filesystemName) diff --git a/tests/integration/ceph_upgrade_test.go b/tests/integration/ceph_upgrade_test.go index 1f6e311e3..327e18475 100644 --- a/tests/integration/ceph_upgrade_test.go +++ b/tests/integration/ceph_upgrade_test.go @@ -50,6 +50,11 @@ func TestCephUpgradeSuite(t *testing.T) { t.Skip() } + // Skip the suite if CSI is not supported + kh, err := utils.CreateK8sHelper(func() *testing.T { return t }) + require.NoError(t, err) + checkSkipCSITest(t, kh) + s := new(UpgradeSuite) defer func(s *UpgradeSuite) { HandlePanics(recover(), s.op, s.T) @@ -90,8 +95,6 @@ func (s *UpgradeSuite) TearDownSuite() { } func (s *UpgradeSuite) TestUpgradeToMaster() { - checkSkipCSITest(s.Suite, s.k8sh) - systemNamespace := installer.SystemNamespace(s.namespace) //