You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
t.Errorf("testcase %s failed, expect no error happened, but got an error: %s", test.name, got.Error())
55
+
Describe("Invalid paths", func() {
56
+
typetestCasestruct {
57
+
namestring
58
+
inputstring
59
+
expecterror
63
60
}
64
-
}
65
-
}
66
-
67
-
funcTestIsSafePathWithInvalidPath(t*testing.T) {
68
-
69
-
typetestCasestruct {
70
-
namestring
71
-
inputstring
72
-
expecterror
73
-
}
74
-
75
-
testCases:= []testCase{
76
-
{
77
-
name: "invalidPath-1",
78
-
input: "/$test/alluxio/default/hbase",
79
-
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "/$test/alluxio/default/hbase", "every directory name in the mount root path shuold follow the relaxed DNS (RFC 1123) rule which additionally allows upper case alphabetic character and character '_'"),
80
-
},
81
-
{
82
-
name: "invalidPath-2",
83
-
input: "/test/(alluxio)/default/hbase",
84
-
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "/test/(alluxio)/default/hbase", "every directory name in the mount root path shuold follow the relaxed DNS (RFC 1123) rule which additionally allows upper case alphabetic character and character '_'"),
85
-
},
86
-
{
87
-
name: "invalidPath-3",
88
-
input: "/test/alluxio/def;ault/hbase",
89
-
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "/test/alluxio/def;ault/hbase", "every directory name in the mount root path shuold follow the relaxed DNS (RFC 1123) rule which additionally allows upper case alphabetic character and character '_'"),
90
-
},
91
-
{
92
-
name: "invalidPath-4",
93
-
input: "",
94
-
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "", "the mount root path is empty"),
95
-
},
96
-
{
97
-
name: "invalidPath-5",
98
-
input: "runtime-mnt/default",
99
-
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "runtime-mnt/default", "the mount root path must be an absolute path"),
100
-
},
101
-
}
102
-
103
-
for_, test:=rangetestCases {
104
-
got:=IsValidMountRoot(test.input)
105
-
ifgot==nil {
106
-
t.Errorf("testcase %s failed, expect an error happened, but got no error", test.name)
61
+
testCases:= []testCase{
62
+
{
63
+
name: "invalidPath-1",
64
+
input: "/$test/alluxio/default/hbase",
65
+
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "/$test/alluxio/default/hbase", "every directory name in the mount root path shuold follow the relaxed DNS (RFC 1123) rule which additionally allows upper case alphabetic character and character '_'"),
66
+
},
67
+
{
68
+
name: "invalidPath-2",
69
+
input: "/test/(alluxio)/default/hbase",
70
+
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "/test/(alluxio)/default/hbase", "every directory name in the mount root path shuold follow the relaxed DNS (RFC 1123) rule which additionally allows upper case alphabetic character and character '_'"),
71
+
},
72
+
{
73
+
name: "invalidPath-3",
74
+
input: "/test/alluxio/def;ault/hbase",
75
+
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "/test/alluxio/def;ault/hbase", "every directory name in the mount root path shuold follow the relaxed DNS (RFC 1123) rule which additionally allows upper case alphabetic character and character '_'"),
76
+
},
77
+
{
78
+
name: "invalidPath-4",
79
+
input: "",
80
+
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "", "the mount root path is empty"),
81
+
},
82
+
{
83
+
name: "invalidPath-5",
84
+
input: "runtime-mnt/default",
85
+
expect: fmt.Errorf(invalidMountRootErrMsgFmt, "runtime-mnt/default", "the mount root path must be an absolute path"),
0 commit comments