mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #13711 from calavera/version_volumes_inspect
Expose new mount points structs in inspect.
This commit is contained in:
commit
50d2597e49
14 changed files with 264 additions and 88 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/go-check/check"
|
||||
)
|
||||
|
||||
|
@ -218,3 +219,44 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) {
|
|||
c.Fatalf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
|
||||
dockerCmd(c, "run", "-d", "--name", "test", "-v", "/data:/data:ro,z", "busybox", "cat")
|
||||
|
||||
vol, err := inspectFieldJSON("test", "Mounts")
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
var mp []types.MountPoint
|
||||
err = unmarshalJSON([]byte(vol), &mp)
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
if len(mp) != 1 {
|
||||
c.Fatalf("Expected 1 mount point, was %v\n", len(mp))
|
||||
}
|
||||
|
||||
m := mp[0]
|
||||
|
||||
if m.Name != "" {
|
||||
c.Fatal("Expected name to be empty")
|
||||
}
|
||||
|
||||
if m.Driver != "" {
|
||||
c.Fatal("Expected driver to be empty")
|
||||
}
|
||||
|
||||
if m.Source != "/data" {
|
||||
c.Fatalf("Expected source /data, was %s\n", m.Source)
|
||||
}
|
||||
|
||||
if m.Destination != "/data" {
|
||||
c.Fatalf("Expected destination /data, was %s\n", m.Destination)
|
||||
}
|
||||
|
||||
if m.Mode != "ro,z" {
|
||||
c.Fatalf("Expected mode `ro,z`, was %s\n", m.Mode)
|
||||
}
|
||||
|
||||
if m.RW != false {
|
||||
c.Fatalf("Expected rw to be false")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue