From 4ce9b45ffdc9b98bcd5fbb375de556a1e4d0e2f6 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Thu, 5 Mar 2020 12:27:14 -0700 Subject: [PATCH] ceph: remove dead test code for cluster purging Cluster purging is no longer called, therefore can be removed. Signed-off-by: Travis Nielsen --- tests/framework/installer/ceph_installer.go | 36 +++----------------- tests/integration/ceph_base_deploy_test.go | 2 +- tests/integration/ceph_multi_cluster_test.go | 2 +- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/tests/framework/installer/ceph_installer.go b/tests/framework/installer/ceph_installer.go index eb97c6289..659bba2d6 100644 --- a/tests/framework/installer/ceph_installer.go +++ b/tests/framework/installer/ceph_installer.go @@ -414,16 +414,14 @@ func (h *CephInstaller) InstallRook(namespace, storeType string, usePVC bool, st } // UninstallRook uninstalls rook from k8s -func (h *CephInstaller) UninstallRook(namespace string, gatherLogs bool) { - h.UninstallRookFromMultipleNS(gatherLogs, SystemNamespace(namespace), namespace) +func (h *CephInstaller) UninstallRook(namespace string) { + h.UninstallRookFromMultipleNS(SystemNamespace(namespace), namespace) } // UninstallRookFromMultipleNS uninstalls rook from multiple namespaces in k8s -func (h *CephInstaller) UninstallRookFromMultipleNS(gatherLogs bool, systemNamespace string, namespaces ...string) { - if gatherLogs { - // Gather logs after status checks - h.GatherAllRookLogs(h.T().Name(), append([]string{systemNamespace}, namespaces...)...) - } +func (h *CephInstaller) UninstallRookFromMultipleNS(systemNamespace string, namespaces ...string) { + // Gather logs after status checks + h.GatherAllRookLogs(h.T().Name(), append([]string{systemNamespace}, namespaces...)...) logger.Infof("Uninstalling Rook") var err error @@ -583,30 +581,6 @@ func (h *CephInstaller) removeClusterFinalizers(namespace, name string) { logger.Infof("removed finalizers from cluster %s", objectMeta.Name) } -func (h *CephInstaller) purgeClusters() error { - // get all namespaces - namespaces, err := h.k8shelper.Clientset.CoreV1().Namespaces().List(metav1.ListOptions{}) - if err != nil { - return fmt.Errorf("failed to get namespaces. %+v", err) - } - - // look for the clusters in all namespaces - for _, n := range namespaces.Items { - namespace := n.Name - logger.Infof("looking in namespace %s for clusters to purge", namespace) - clusters, err := h.k8shelper.RookClientset.CephV1().CephClusters(namespace).List(metav1.ListOptions{}) - if err != nil { - logger.Warningf("failed to get clusters in namespace %s. %+v", namespace, err) - continue - } - if len(clusters.Items) > 0 { - logger.Warningf("FOUND UNEXPECTED CLUSTER IN NAMESPACE %s. Removing...", namespace) - h.UninstallRook(namespace, false) - } - } - return nil -} - func (h *CephInstaller) checkCephHealthStatus(namespace string) { clusterResource, err := h.k8shelper.RookClientset.CephV1().CephClusters(namespace).Get(namespace, metav1.GetOptions{}) assert.Nil(h.T(), err) diff --git a/tests/integration/ceph_base_deploy_test.go b/tests/integration/ceph_base_deploy_test.go index 47207978a..84414731a 100644 --- a/tests/integration/ceph_base_deploy_test.go +++ b/tests/integration/ceph_base_deploy_test.go @@ -176,5 +176,5 @@ func (op *TestCluster) SetInstallData(version string) {} // TearDownRook is a wrapper for tearDown after Suite func (op *TestCluster) Teardown() { - op.installer.UninstallRook(op.namespace, true) + op.installer.UninstallRook(op.namespace) } diff --git a/tests/integration/ceph_multi_cluster_test.go b/tests/integration/ceph_multi_cluster_test.go index de3e80228..2c56fb8fc 100644 --- a/tests/integration/ceph_multi_cluster_test.go +++ b/tests/integration/ceph_multi_cluster_test.go @@ -177,7 +177,7 @@ func (o MCTestOperations) Setup() { // TearDownRook is a wrapper for tearDown after suite func (o MCTestOperations) Teardown() { - o.installer.UninstallRookFromMultipleNS(true, installer.SystemNamespace(o.namespace1), o.namespace1, o.namespace2) + o.installer.UninstallRookFromMultipleNS(installer.SystemNamespace(o.namespace1), o.namespace1, o.namespace2) } func (o MCTestOperations) startCluster(namespace, store string) error {