Skip to content

Commit 0d8402b

Browse files
committed
cleanup: getRootDir function
1 parent 5651c85 commit 0d8402b

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

pkg/nfs/utils.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,6 @@ func waitForPathNotExistWithTimeout(path string, timeout time.Duration) error {
217217
}
218218
}
219219

220-
// getRootDir returns the root directory of the given directory
221-
func getRootDir(path string) string {
222-
parts := strings.Split(path, "/")
223-
return parts[0]
224-
}
225-
226220
// removeEmptyDirs removes empty directories in the given directory dir until the parent directory parentDir
227221
// It will remove all empty directories in the path from the given directory to the parent directory
228222
// It will not remove the parent directory parentDir

pkg/nfs/utils_test.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -388,47 +388,6 @@ func TestWaitForPathNotExistWithTimeout(t *testing.T) {
388388
}
389389
}
390390

391-
func TestGetRootPath(t *testing.T) {
392-
tests := []struct {
393-
desc string
394-
dir string
395-
expected string
396-
}{
397-
{
398-
desc: "empty path",
399-
dir: "",
400-
expected: "",
401-
},
402-
{
403-
desc: "root path",
404-
dir: "/",
405-
expected: "",
406-
},
407-
{
408-
desc: "subdir path",
409-
dir: "/subdir",
410-
expected: "",
411-
},
412-
{
413-
desc: "subdir path without leading slash",
414-
dir: "subdir",
415-
expected: "subdir",
416-
},
417-
{
418-
desc: "multiple subdir path without leading slash",
419-
dir: "subdir/subdir2",
420-
expected: "subdir",
421-
},
422-
}
423-
424-
for _, test := range tests {
425-
result := getRootDir(test.dir)
426-
if result != test.expected {
427-
t.Errorf("Unexpected result: %s, expected: %s", result, test.expected)
428-
}
429-
}
430-
}
431-
432391
func TestRemoveEmptyDirs(t *testing.T) {
433392
parentDir, _ := os.Getwd()
434393
emptyDirOneLevel, _ := getWorkDirPath("emptyDir1")

0 commit comments

Comments
 (0)