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