From f88a2b13f914c12a6be38a603bf671bf4d366b81 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Fri, 12 Mar 2021 15:50:15 -0500 Subject: [PATCH] cephfs: remove useMount test helper function Now that there are no tests using the fuse mount point and the useMount function that detects an external mount point is needed, we can remove the useMount function itself and the env var used to control it. Signed-off-by: John Mulligan --- cephfs/cephfs_test.go | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/cephfs/cephfs_test.go b/cephfs/cephfs_test.go index 5162827..f7cf42a 100644 --- a/cephfs/cephfs_test.go +++ b/cephfs/cephfs_test.go @@ -3,8 +3,6 @@ package cephfs import ( "fmt" "os" - "path" - "syscall" "testing" "time" @@ -15,54 +13,16 @@ import ( ) var ( - CephMountDir = "/tmp/ceph/mds/mnt/" - requireCephMount = false - testMdsName = "Z" + testMdsName = "Z" ) func init() { - mdir := os.Getenv("GO_CEPH_TEST_MOUNT_DIR") - if mdir != "" { - CephMountDir = mdir - } - reqMount := os.Getenv("GO_CEPH_TEST_REQUIRE_MOUNT") - if reqMount == "yes" || reqMount == "true" { - requireCephMount = true - } mdsName := os.Getenv("GO_CEPH_TEST_MDS_NAME") if mdsName != "" { testMdsName = mdsName } } -func useMount(t *testing.T) { - fail := func(m string) { - if requireCephMount { - t.Fatalf("cephfs mount required: %s %s", CephMountDir, m) - } else { - t.Skipf("cephfs mount needed: %s %s", CephMountDir, m) - } - } - - s, err := os.Stat(CephMountDir) - if err != nil || !s.IsDir() { - fail("missing or not a directory") - } - - if us, ok := s.Sys().(*syscall.Stat_t); ok { - ps, err := os.Stat(path.Dir(path.Clean(CephMountDir))) - if err != nil { - fail("missing parent directory (race condition?)") - } - if ps.Sys().(*syscall.Stat_t).Dev == us.Dev { - fail("not a mount point") - } - } else { - fail("not a unix-like file system? how did you even compile this?" + - "no, seriously please contact us or file an issue and let us know!") - } -} - func TestCreateMount(t *testing.T) { mount, err := CreateMount() assert.NoError(t, err)