From c348598daf7cc15fa6482f8642e90ab2a4193b64 Mon Sep 17 00:00:00 2001 From: xiaojingchen Date: Mon, 5 Aug 2019 21:42:06 +0800 Subject: [PATCH] refine clean logic (#719) --- tests/actions.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/actions.go b/tests/actions.go index 09e1a93c52..4c21638ec6 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -619,6 +619,12 @@ func (oa *operatorActions) CleanTidbCluster(info *TidbClusterConfig) error { setStr := label.New().Instance(info.ClusterName).String() + // delete all jobs + allJobsSet := label.Label{}.Instance(info.ClusterName).String() + if res, err := exec.Command("kubectl", "delete", "jobs", "-n", info.Namespace, "-l", allJobsSet).CombinedOutput(); err != nil { + return fmt.Errorf("failed to delete jobs: %v, %s", err, string(res)) + } + resources := []string{"pvc"} for _, resource := range resources { if res, err := exec.Command("kubectl", "delete", resource, "-n", info.Namespace, "-l", @@ -627,12 +633,6 @@ func (oa *operatorActions) CleanTidbCluster(info *TidbClusterConfig) error { } } - // delete all jobs - allJobsSet := label.Label{}.Instance(info.ClusterName).String() - if res, err := exec.Command("kubectl", "delete", "jobs", "-n", info.Namespace, "-l", allJobsSet).CombinedOutput(); err != nil { - return fmt.Errorf("failed to delete jobs: %v, %s", err, string(res)) - } - // delete all configmaps allConfigMaps := label.New().Instance(info.ClusterName).String() if res, err := exec.Command("kubectl", "delete", "configmaps", "-n", info.Namespace, "-l", allConfigMaps).CombinedOutput(); err != nil {