mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 21:51:33 +00:00
Merge pull request #13161 from calavera/plugin_discovery
Proposal: Volume refactor and external volume plugins
This commit is contained in:
@@ -395,21 +395,6 @@ func (s *DockerSuite) TestRunModeNetContainerHostname(c *check.C) {
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for #4741
|
||||
func (s *DockerSuite) TestRunWithVolumesAsFiles(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "--name", "test-data", "--volume", "/etc/hosts:/target-file", "busybox", "true")
|
||||
out, stderr, exitCode, err := runCommandWithStdoutStderr(runCmd)
|
||||
if err != nil && exitCode != 0 {
|
||||
c.Fatal("1", out, stderr, err)
|
||||
}
|
||||
|
||||
runCmd = exec.Command(dockerBinary, "run", "--volumes-from", "test-data", "busybox", "cat", "/target-file")
|
||||
out, stderr, exitCode, err = runCommandWithStdoutStderr(runCmd)
|
||||
if err != nil && exitCode != 0 {
|
||||
c.Fatal("2", out, stderr, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for #4979
|
||||
func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "--name", "test-data", "--volume", "/some/dir", "busybox", "touch", "/some/dir/file")
|
||||
@@ -455,14 +440,6 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) {
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for #4830
|
||||
func (s *DockerSuite) TestRunWithRelativePath(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "-v", "tmp:/other-tmp", "busybox", "true")
|
||||
if _, _, _, err := runCommandWithStdoutStderr(runCmd); err == nil {
|
||||
c.Fatalf("relative path should result in an error")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunVolumesMountedAsReadonly(c *check.C) {
|
||||
cmd := exec.Command(dockerBinary, "run", "-v", "/test:/test:ro", "busybox", "touch", "/test/somefile")
|
||||
if code, err := runCommand(cmd); err == nil || code == 0 {
|
||||
@@ -536,7 +513,7 @@ func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
|
||||
if out, _, err := runCommandWithOutput(cmd); err == nil {
|
||||
c.Fatal("Expected error about duplicate volume definitions")
|
||||
} else {
|
||||
if !strings.Contains(out, "Duplicate volume") {
|
||||
if !strings.Contains(out, "Duplicate bind mount") {
|
||||
c.Fatalf("Expected 'duplicate volume' error, got %v", err)
|
||||
}
|
||||
}
|
||||
@@ -2333,7 +2310,13 @@ func (s *DockerSuite) TestRunMountOrdering(c *check.C) {
|
||||
c.Fatal(err)
|
||||
}
|
||||
|
||||
cmd := exec.Command(dockerBinary, "run", "-v", fmt.Sprintf("%s:/tmp", tmpDir), "-v", fmt.Sprintf("%s:/tmp/foo", fooDir), "-v", fmt.Sprintf("%s:/tmp/tmp2", tmpDir2), "-v", fmt.Sprintf("%s:/tmp/tmp2/foo", fooDir), "busybox:latest", "sh", "-c", "ls /tmp/touch-me && ls /tmp/foo/touch-me && ls /tmp/tmp2/touch-me && ls /tmp/tmp2/foo/touch-me")
|
||||
cmd := exec.Command(dockerBinary, "run",
|
||||
"-v", fmt.Sprintf("%s:/tmp", tmpDir),
|
||||
"-v", fmt.Sprintf("%s:/tmp/foo", fooDir),
|
||||
"-v", fmt.Sprintf("%s:/tmp/tmp2", tmpDir2),
|
||||
"-v", fmt.Sprintf("%s:/tmp/tmp2/foo", fooDir),
|
||||
"busybox:latest", "sh", "-c",
|
||||
"ls /tmp/touch-me && ls /tmp/foo/touch-me && ls /tmp/tmp2/touch-me && ls /tmp/tmp2/foo/touch-me")
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
if err != nil {
|
||||
c.Fatal(out, err)
|
||||
@@ -2427,41 +2410,6 @@ func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunVolumesNotRecreatedOnStart(c *check.C) {
|
||||
testRequires(c, SameHostDaemon)
|
||||
|
||||
// Clear out any remnants from other tests
|
||||
info, err := ioutil.ReadDir(volumesConfigPath)
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
if len(info) > 0 {
|
||||
for _, f := range info {
|
||||
if err := os.RemoveAll(volumesConfigPath + "/" + f.Name()); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmd := exec.Command(dockerBinary, "run", "-v", "/foo", "--name", "lone_starr", "busybox")
|
||||
if _, err := runCommand(cmd); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
|
||||
cmd = exec.Command(dockerBinary, "start", "lone_starr")
|
||||
if _, err := runCommand(cmd); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
|
||||
info, err = ioutil.ReadDir(volumesConfigPath)
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
if len(info) != 1 {
|
||||
c.Fatalf("Expected only 1 volume have %v", len(info))
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunNoOutputFromPullInStdout(c *check.C) {
|
||||
// just run with unknown image
|
||||
cmd := exec.Command(dockerBinary, "run", "asdfsg")
|
||||
@@ -2496,7 +2444,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
|
||||
|
||||
out, err = inspectFieldMap("dark_helmet", "Volumes", "/foo")
|
||||
c.Assert(err, check.IsNil)
|
||||
if !strings.Contains(out, volumesStoragePath) {
|
||||
if !strings.Contains(out, volumesConfigPath) {
|
||||
c.Fatalf("Volume was not defined for /foo\n%q", out)
|
||||
}
|
||||
|
||||
@@ -2507,7 +2455,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
|
||||
}
|
||||
out, err = inspectFieldMap("dark_helmet", "Volumes", "/bar")
|
||||
c.Assert(err, check.IsNil)
|
||||
if !strings.Contains(out, volumesStoragePath) {
|
||||
if !strings.Contains(out, volumesConfigPath) {
|
||||
c.Fatalf("Volume was not defined for /bar\n%q", out)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user