mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #17167 from liaoqingwei/16756-docker_cli_inspect_experimental_test.go
Use of checkers on docker_cli_inspect_experimental_test.go
This commit is contained in:
commit
1c783567c0
1 changed files with 9 additions and 20 deletions
|
@ -4,6 +4,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/pkg/integration/checker"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,34 +13,22 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
|
||||||
dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:/data", "busybox", "cat")
|
dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:/data", "busybox", "cat")
|
||||||
|
|
||||||
vol, err := inspectFieldJSON("test", "Mounts")
|
vol, err := inspectFieldJSON("test", "Mounts")
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
var mp []types.MountPoint
|
var mp []types.MountPoint
|
||||||
err = unmarshalJSON([]byte(vol), &mp)
|
err = unmarshalJSON([]byte(vol), &mp)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
if len(mp) != 1 {
|
c.Assert(mp, checker.HasLen, 1, check.Commentf("Expected 1 mount point"))
|
||||||
c.Fatalf("Expected 1 mount point, was %v\n", len(mp))
|
|
||||||
}
|
|
||||||
|
|
||||||
m := mp[0]
|
m := mp[0]
|
||||||
if m.Name != "data" {
|
c.Assert(m.Name, checker.Equals, "data", check.Commentf("Expected name data"))
|
||||||
c.Fatalf("Expected name data, was %s\n", m.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.Driver != "local" {
|
c.Assert(m.Driver, checker.Equals, "local", check.Commentf("Expected driver local"))
|
||||||
c.Fatalf("Expected driver local, was %s\n", m.Driver)
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.Source == "" {
|
c.Assert(m.Source, checker.Not(checker.Equals), "", check.Commentf("Expected source to not be empty"))
|
||||||
c.Fatalf("Expected source to not be empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.RW != true {
|
c.Assert(m.RW, checker.Equals, true)
|
||||||
c.Fatalf("Expected rw to be true")
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.Destination != "/data" {
|
c.Assert(m.Destination, checker.Equals, "/data", check.Commentf("Expected destination /data"))
|
||||||
c.Fatalf("Expected destination /data, was %s\n", m.Destination)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue