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