github.com/damirazo/docker@v1.9.0/integration-cli/docker_cli_inspect_experimental_test.go (about)

     1  // +build experimental
     2  
     3  package main
     4  
     5  import (
     6  	"github.com/docker/docker/api/types"
     7  	"github.com/go-check/check"
     8  )
     9  
    10  func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
    11  	testRequires(c, DaemonIsLinux)
    12  	dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:/data", "busybox", "cat")
    13  
    14  	vol, err := inspectFieldJSON("test", "Mounts")
    15  	c.Assert(err, check.IsNil)
    16  
    17  	var mp []types.MountPoint
    18  	err = unmarshalJSON([]byte(vol), &mp)
    19  	c.Assert(err, check.IsNil)
    20  
    21  	if len(mp) != 1 {
    22  		c.Fatalf("Expected 1 mount point, was %v\n", len(mp))
    23  	}
    24  
    25  	m := mp[0]
    26  	if m.Name != "data" {
    27  		c.Fatalf("Expected name data, was %s\n", m.Name)
    28  	}
    29  
    30  	if m.Driver != "local" {
    31  		c.Fatalf("Expected driver local, was %s\n", m.Driver)
    32  	}
    33  
    34  	if m.Source == "" {
    35  		c.Fatalf("Expected source to not be empty")
    36  	}
    37  
    38  	if m.RW != true {
    39  		c.Fatalf("Expected rw to be true")
    40  	}
    41  
    42  	if m.Destination != "/data" {
    43  		c.Fatalf("Expected destination /data, was %s\n", m.Destination)
    44  	}
    45  }