|
@@ -35,7 +35,6 @@ import (
|
|
testdaemon "github.com/docker/docker/internal/test/daemon"
|
|
testdaemon "github.com/docker/docker/internal/test/daemon"
|
|
"github.com/docker/docker/opts"
|
|
"github.com/docker/docker/opts"
|
|
"github.com/docker/docker/pkg/mount"
|
|
"github.com/docker/docker/pkg/mount"
|
|
- "github.com/docker/docker/pkg/stringid"
|
|
|
|
units "github.com/docker/go-units"
|
|
units "github.com/docker/go-units"
|
|
"github.com/docker/libnetwork/iptables"
|
|
"github.com/docker/libnetwork/iptables"
|
|
"github.com/docker/libtrust"
|
|
"github.com/docker/libtrust"
|
|
@@ -2672,84 +2671,6 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
|
c.Assert(out, checker.Equals, errMsg1)
|
|
c.Assert(out, checker.Equals, errMsg1)
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) {
|
|
|
|
- testRequires(c, SameHostDaemon)
|
|
|
|
- d := s.d
|
|
|
|
- d.StartWithBusybox(c)
|
|
|
|
-
|
|
|
|
- // hack to be able to side-load a container config
|
|
|
|
- out, err := d.Cmd("create", "busybox:latest")
|
|
|
|
- c.Assert(err, checker.IsNil, check.Commentf(out))
|
|
|
|
- id := strings.TrimSpace(out)
|
|
|
|
-
|
|
|
|
- out, err = d.Cmd("inspect", "--type=image", "--format={{.ID}}", "busybox:latest")
|
|
|
|
- c.Assert(err, checker.IsNil, check.Commentf(out))
|
|
|
|
- d.Stop(c)
|
|
|
|
- <-d.Wait
|
|
|
|
-
|
|
|
|
- imageID := strings.TrimSpace(out)
|
|
|
|
- volumeID := stringid.GenerateNonCryptoID()
|
|
|
|
- vfsPath := filepath.Join(d.Root, "vfs", "dir", volumeID)
|
|
|
|
- c.Assert(os.MkdirAll(vfsPath, 0755), checker.IsNil)
|
|
|
|
-
|
|
|
|
- config := []byte(`
|
|
|
|
- {
|
|
|
|
- "ID": "` + id + `",
|
|
|
|
- "Name": "hello",
|
|
|
|
- "Driver": "` + d.StorageDriver() + `",
|
|
|
|
- "Image": "` + imageID + `",
|
|
|
|
- "Config": {"Image": "busybox:latest"},
|
|
|
|
- "NetworkSettings": {},
|
|
|
|
- "Volumes": {
|
|
|
|
- "/bar":"/foo",
|
|
|
|
- "/foo": "` + vfsPath + `",
|
|
|
|
- "/quux":"/quux"
|
|
|
|
- },
|
|
|
|
- "VolumesRW": {
|
|
|
|
- "/bar": true,
|
|
|
|
- "/foo": true,
|
|
|
|
- "/quux": false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- `)
|
|
|
|
-
|
|
|
|
- configPath := filepath.Join(d.Root, "containers", id, "config.v2.json")
|
|
|
|
- c.Assert(ioutil.WriteFile(configPath, config, 600), checker.IsNil)
|
|
|
|
- d.Start(c)
|
|
|
|
-
|
|
|
|
- out, err = d.Cmd("inspect", "--type=container", "--format={{ json .Mounts }}", id)
|
|
|
|
- c.Assert(err, checker.IsNil, check.Commentf(out))
|
|
|
|
- type mount struct {
|
|
|
|
- Name string
|
|
|
|
- Source string
|
|
|
|
- Destination string
|
|
|
|
- Driver string
|
|
|
|
- RW bool
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ls := []mount{}
|
|
|
|
- err = json.NewDecoder(strings.NewReader(out)).Decode(&ls)
|
|
|
|
- c.Assert(err, checker.IsNil)
|
|
|
|
-
|
|
|
|
- expected := []mount{
|
|
|
|
- {Source: "/foo", Destination: "/bar", RW: true},
|
|
|
|
- {Name: volumeID, Destination: "/foo", RW: true},
|
|
|
|
- {Source: "/quux", Destination: "/quux", RW: false},
|
|
|
|
- }
|
|
|
|
- c.Assert(ls, checker.HasLen, len(expected))
|
|
|
|
-
|
|
|
|
- for _, m := range ls {
|
|
|
|
- var matched bool
|
|
|
|
- for _, x := range expected {
|
|
|
|
- if m.Source == x.Source && m.Destination == x.Destination && m.RW == x.RW || m.Name != x.Name {
|
|
|
|
- matched = true
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- c.Assert(matched, checker.True, check.Commentf("did find match for %+v", m))
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) {
|
|
func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) {
|
|
testRequires(c, SameHostDaemon, DaemonIsLinux)
|
|
testRequires(c, SameHostDaemon, DaemonIsLinux)
|
|
|
|
|