diff --git a/pkg/pmem-device-manager/pmd-lvm_test.go b/pkg/pmem-device-manager/pmd-lvm_test.go index e80c0d7a7e..ee233a8be4 100644 --- a/pkg/pmem-device-manager/pmd-lvm_test.go +++ b/pkg/pmem-device-manager/pmd-lvm_test.go @@ -29,23 +29,22 @@ const ( ModeDirect = "direct" ) -var mode string = ModeLVM - func TestMain(m *testing.M) { RegisterFailHandler(Fail) - if deviceMode := os.Getenv("TEST_DEVICEMODE"); deviceMode == ModeDirect { - mode = deviceMode - } - os.Exit(m.Run()) } func TestPmdLVM(t *testing.T) { - RunSpecs(t, fmt.Sprintf("PMEM Device manager Suite(Mode: %s)", mode)) + RunSpecs(t, "PMEM Device manager Suite") } var _ = Describe("DeviceManager", func() { + Context(ModeLVM, func() { runTest(ModeLVM) }) + Context(ModeDirect, func() { runTest(ModeDirect) }) +}) + +func runTest(mode string) { var dm PmemDeviceManager var vg *testVGS var cleanupList map[string]bool = map[string]bool{} @@ -188,7 +187,7 @@ var _ = Describe("DeviceManager", func() { Expect(err).Should(BeNil(), "DeleteDevice() is not idempotent") }) // }) -}) +} func precheck() { if os.Geteuid() != 0 { diff --git a/test/test.make b/test/test.make index eeaa87a72e..2fa1438002 100644 --- a/test/test.make +++ b/test/test.make @@ -149,8 +149,7 @@ run_dm_tests: start_test_vm WORKER=$(shell grep ^exec `pwd`/_work/$(CLUSTER)/ssh.0 | rev | cut -f2 -d' ' | rev) && \ SSH_ARGS="$(shell grep ^exec `pwd`/_work/$(CLUSTER)/ssh.0 | cut -f3- -d' ' | rev | cut -f3- -d' ' | rev)" && \ scp $$SSH_ARGS `pwd`/_work/$(TEST_BINARY_NAME) $$WORKER:. && \ - $(PWD)/_work/$(CLUSTER)/ssh.0 sudo env TEST_DEVICEMODE=lvm ./$(TEST_BINARY_NAME) -ginkgo.v && \ - $(PWD)/_work/$(CLUSTER)/ssh.0 sudo env TEST_DEVICEMODE=direct ./$(TEST_BINARY_NAME) -ginkgo.v && \ + $(PWD)/_work/$(CLUSTER)/ssh.0 sudo ./$(TEST_BINARY_NAME) -ginkgo.v && \ $(MAKE) stop