mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
server: Validate server arguments for duplicates. (#2554)
- Validates invalid format inputs. - Validates duplicate entries. - Validates sufficient amount of disks. Partially fixes #2502
This commit is contained in:
@@ -31,11 +31,26 @@ func TestSplitNetPath(t *testing.T) {
|
||||
netPath string
|
||||
err error
|
||||
}{
|
||||
// Invalid cases 1-8.
|
||||
{":C:", "", "", &net.AddrError{Err: "Missing address in network path", Addr: ":C:"}},
|
||||
{"10.1.10.1:", "", "", &net.AddrError{Err: "Missing path in network path", Addr: "10.1.10.1:"}},
|
||||
{"10.1.10.1:C", "", "", &net.AddrError{Err: "Network path should be absolute", Addr: "10.1.10.1:C"}},
|
||||
{"10.1.10.1:C:", "", "", &net.AddrError{Err: "Network path should be absolute", Addr: "10.1.10.1:C:"}},
|
||||
{"10.1.10.1:C:../path", "", "", &net.AddrError{Err: "Network path should be absolute", Addr: "10.1.10.1:C:../path"}},
|
||||
{"10.1.10.1:C:tmp/1", "", "", &net.AddrError{Err: "Network path should be absolute", Addr: "10.1.10.1:C:tmp/1"}},
|
||||
{"10.1.10.1::C:\\path\\test", "", "", &net.AddrError{
|
||||
Err: "Network path should be absolute",
|
||||
Addr: "10.1.10.1::C:\\path\\test",
|
||||
}},
|
||||
{"10.1.10.1:\\path\\test", "", "", &net.AddrError{
|
||||
Err: "Network path should be absolute",
|
||||
Addr: "10.1.10.1:\\path\\test",
|
||||
}},
|
||||
|
||||
// Valid cases 9-11.
|
||||
{"10.1.10.1:C:\\path\\test", "10.1.10.1", "C:\\path\\test", nil},
|
||||
{"10.1.10.1:C:", "10.1.10.1", "C:", nil},
|
||||
{":C:", "", "", &net.AddrError{Err: "missing address in network path", Addr: ":C:"}},
|
||||
{"C:\\path\\test", "", "C:\\path\\test", nil},
|
||||
{"10.1.10.1::C:\\path\\test", "10.1.10.1", ":C:\\path\\test", nil},
|
||||
{`10.1.10.1:\\?\UNC\path\test`, "10.1.10.1", `\\?\UNC\path\test`, nil},
|
||||
}
|
||||
|
||||
for i, test := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user