|
@@ -33,29 +33,28 @@ func TestGetVolumeDriver(t *testing.T) {
|
|
|
|
|
|
func TestParseBindMount(t *testing.T) {
|
|
|
cases := []struct {
|
|
|
- bind string
|
|
|
- driver string
|
|
|
- expDest string
|
|
|
- expSource string
|
|
|
- expName string
|
|
|
- expDriver string
|
|
|
- mountLabel string
|
|
|
- expRW bool
|
|
|
- fail bool
|
|
|
+ bind string
|
|
|
+ driver string
|
|
|
+ expDest string
|
|
|
+ expSource string
|
|
|
+ expName string
|
|
|
+ expDriver string
|
|
|
+ expRW bool
|
|
|
+ fail bool
|
|
|
}{
|
|
|
- {"/tmp:/tmp", "", "/tmp", "/tmp", "", "", "", true, false},
|
|
|
- {"/tmp:/tmp:ro", "", "/tmp", "/tmp", "", "", "", false, false},
|
|
|
- {"/tmp:/tmp:rw", "", "/tmp", "/tmp", "", "", "", true, false},
|
|
|
- {"/tmp:/tmp:foo", "", "/tmp", "/tmp", "", "", "", false, true},
|
|
|
- {"name:/tmp", "", "/tmp", "", "name", "local", "", true, false},
|
|
|
- {"name:/tmp", "external", "/tmp", "", "name", "external", "", true, false},
|
|
|
- {"name:/tmp:ro", "local", "/tmp", "", "name", "local", "", false, false},
|
|
|
- {"local/name:/tmp:rw", "", "/tmp", "", "local/name", "local", "", true, false},
|
|
|
- {"/tmp:tmp", "", "", "", "", "", "", true, true},
|
|
|
+ {"/tmp:/tmp", "", "/tmp", "/tmp", "", "", true, false},
|
|
|
+ {"/tmp:/tmp:ro", "", "/tmp", "/tmp", "", "", false, false},
|
|
|
+ {"/tmp:/tmp:rw", "", "/tmp", "/tmp", "", "", true, false},
|
|
|
+ {"/tmp:/tmp:foo", "", "/tmp", "/tmp", "", "", false, true},
|
|
|
+ {"name:/tmp", "", "/tmp", "", "name", "local", true, false},
|
|
|
+ {"name:/tmp", "external", "/tmp", "", "name", "external", true, false},
|
|
|
+ {"name:/tmp:ro", "local", "/tmp", "", "name", "local", false, false},
|
|
|
+ {"local/name:/tmp:rw", "", "/tmp", "", "local/name", "local", true, false},
|
|
|
+ {"/tmp:tmp", "", "", "", "", "", true, true},
|
|
|
}
|
|
|
|
|
|
for _, c := range cases {
|
|
|
- m, err := parseBindMount(c.bind, c.mountLabel, c.driver)
|
|
|
+ m, err := parseBindMount(c.bind, c.driver)
|
|
|
if c.fail {
|
|
|
if err == nil {
|
|
|
t.Fatalf("Expected error, was nil, for spec %s\n", c.bind)
|