Skip to content

Commit

Permalink
test(ci): adding vgops wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Abhilash Shetty <[email protected]>
  • Loading branch information
abhilashshetty04 committed Jun 25, 2024
1 parent 52bcb45 commit c8a3188
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions tests/lvm_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,6 @@ import (
"github.com/onsi/gomega"
)

// enable the monitoring on thinpool created for test, on local node which
// is part of single node cluster.
func enableThinpoolMonitoring() {
lv := VOLGROUP + "/" + pvcObj.Spec.VolumeName

args := []string{
"lvdisplay", "--columns",
"--options", "pool_lv",
"--noheadings",
lv,
}
stdout, _, err := execAtLocal("sudo", nil, args...)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred(), "display LV")
gomega.Expect(strings.TrimSpace(string(stdout))).To(gomega.Not(gomega.Equal("")), "get thinpool LV")

thinpool := VOLGROUP + "/" + strings.TrimSpace(string(stdout))

args = []string{
"lvchange",
"--monitor", "y",
thinpool,
}

_, _, err = execAtLocal("sudo", nil, args...)
gomega.Expect(err).To(gomega.BeNil(), "run lvchange command")
}

// This creates loopdevice using the size passed as arg,
// Uses the new loop device to create PV. returns loopdevice name to the caller.
func createPV(size int) string {
Expand All @@ -62,7 +35,7 @@ func createPV(size int) string {
"--dry-run",
}
file, _, _ := execAtLocal("sudo", nil, back_file_args...)

file_str := strings.TrimSpace(string(file[:]))
size_str := strconv.Itoa(size) + "G"
device_args := []string{
Expand Down Expand Up @@ -161,6 +134,33 @@ func removeVg(name string) {
gomega.Expect(err_vg).To(gomega.BeNil(), "vg remove failed")
}

// enable the monitoring on thinpool created for test, on local node which
// is part of single node cluster.
func enableThinpoolMonitoring() {
lv := VOLGROUP + "/" + pvcObj.Spec.VolumeName

args := []string{
"lvdisplay", "--columns",
"--options", "pool_lv",
"--noheadings",
lv,
}
stdout, _, err := execAtLocal("sudo", nil, args...)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred(), "display LV")
gomega.Expect(strings.TrimSpace(string(stdout))).To(gomega.Not(gomega.Equal("")), "get thinpool LV")

thinpool := VOLGROUP + "/" + strings.TrimSpace(string(stdout))

args = []string{
"lvchange",
"--monitor", "y",
thinpool,
}

_, _, err = execAtLocal("sudo", nil, args...)
gomega.Expect(err).To(gomega.BeNil(), "run lvchange command")
}

// verify that the thinpool has extended in capacity to an expected size.
func VerifyThinpoolExtend() {
expect_size, _ := strconv.ParseInt(expanded_capacity, 10, 64)
Expand Down

0 comments on commit c8a3188

Please sign in to comment.