diff --git a/tests/lvm_utils.go b/tests/lvm_utils.go index a92a177f..fd954b69 100644 --- a/tests/lvm_utils.go +++ b/tests/lvm_utils.go @@ -151,7 +151,10 @@ func removeVg(name string) { ginkgo.By("Removing vg") retries := 3 current_retry := 0 - force := false + args_vg := []string{ + "vgremove", + name, + } for { if current_retry < retries { vg_empty := vgEmpty(name) @@ -162,21 +165,13 @@ func removeVg(name string) { fmt.Printf("lv in vg during retry %d\n", current_retry) } } else { - force = true + fmt.Printf("vg still not empty after 6 seconds, moving on with force delete\n") + args_vg = append(args_vg, "-y") break } current_retry += 1 time.Sleep(2 * time.Second) } - - args_vg := []string{ - "vgremove", - name, - } - if force { - fmt.Printf("vg still not empty after 6 seconds, moving on with force delete\n") - args_vg = append(args_vg, "-y") - } _, _, err_vg := execAtLocal("sudo", nil, args_vg...) gomega.Expect(err_vg).To(gomega.BeNil(), "vg remove failed") }