github.com/skanehira/moby@v17.12.1-ce-rc2+incompatible/integration-cli/docker_cli_create_unix_test.go (about) 1 // +build !windows 2 3 package main 4 5 import ( 6 "strings" 7 8 "github.com/go-check/check" 9 ) 10 11 // Test case for #30166 (target was not validated) 12 func (s *DockerSuite) TestCreateTmpfsMountsTarget(c *check.C) { 13 testRequires(c, DaemonIsLinux) 14 type testCase struct { 15 target string 16 expectedError string 17 } 18 cases := []testCase{ 19 { 20 target: ".", 21 expectedError: "mount path must be absolute", 22 }, 23 { 24 target: "foo", 25 expectedError: "mount path must be absolute", 26 }, 27 { 28 target: "/", 29 expectedError: "destination can't be '/'", 30 }, 31 { 32 target: "//", 33 expectedError: "destination can't be '/'", 34 }, 35 } 36 for _, x := range cases { 37 out, _, _ := dockerCmdWithError("create", "--tmpfs", x.target, "busybox", "sh") 38 if x.expectedError != "" && !strings.Contains(out, x.expectedError) { 39 c.Fatalf("mounting tmpfs over %q should fail with %q, but got %q", 40 x.target, x.expectedError, out) 41 } 42 } 43 }