2015-06-03 22:21:38 +03:00
|
|
|
// +build experimental
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-10-19 13:25:35 +03:00
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
2016-01-05 03:05:26 +03:00
|
|
|
"github.com/docker/engine-api/types"
|
2015-06-03 22:21:38 +03:00
|
|
|
"github.com/go-check/check"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
|
2015-08-28 20:36:42 +03:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-06-03 22:21:38 +03:00
|
|
|
dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:/data", "busybox", "cat")
|
|
|
|
|
2016-01-28 17:19:25 +03:00
|
|
|
vol := inspectFieldJSON(c, "test", "Mounts")
|
2015-06-03 22:21:38 +03:00
|
|
|
|
|
|
|
var mp []types.MountPoint
|
2016-01-28 17:19:25 +03:00
|
|
|
err := unmarshalJSON([]byte(vol), &mp)
|
2015-10-19 13:25:35 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
2015-06-03 22:21:38 +03:00
|
|
|
|
2015-10-19 13:25:35 +03:00
|
|
|
c.Assert(mp, checker.HasLen, 1, check.Commentf("Expected 1 mount point"))
|
2015-06-03 22:21:38 +03:00
|
|
|
|
|
|
|
m := mp[0]
|
2015-10-19 13:25:35 +03:00
|
|
|
c.Assert(m.Name, checker.Equals, "data", check.Commentf("Expected name data"))
|
2015-06-03 22:21:38 +03:00
|
|
|
|
2015-10-19 13:25:35 +03:00
|
|
|
c.Assert(m.Driver, checker.Equals, "local", check.Commentf("Expected driver local"))
|
2015-06-03 22:21:38 +03:00
|
|
|
|
2015-10-19 13:25:35 +03:00
|
|
|
c.Assert(m.Source, checker.Not(checker.Equals), "", check.Commentf("Expected source to not be empty"))
|
2015-06-03 22:21:38 +03:00
|
|
|
|
2015-10-19 13:25:35 +03:00
|
|
|
c.Assert(m.RW, checker.Equals, true)
|
2015-06-03 22:21:38 +03:00
|
|
|
|
2015-10-19 13:25:35 +03:00
|
|
|
c.Assert(m.Destination, checker.Equals, "/data", check.Commentf("Expected destination /data"))
|
2015-06-03 22:21:38 +03:00
|
|
|
}
|