mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Cleanup volume plugin test with bad assumptions
Test made some bad assumptions about on-disk state of volume data. This updates the test to only test based on what the volume API is designed to provide. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
e6f784e3df
commit
0df654f3d6
1 changed files with 2 additions and 25 deletions
|
@ -3,8 +3,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/integration-cli/checker"
|
"github.com/docker/docker/integration-cli/checker"
|
||||||
|
@ -199,12 +197,6 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Fatalf("Could not install plugin: %v %s", err, out)
|
c.Fatalf("Could not install plugin: %v %s", err, out)
|
||||||
}
|
}
|
||||||
pluginID, err := s.d.Cmd("plugin", "inspect", "-f", "{{.Id}}", pName)
|
|
||||||
pluginID = strings.TrimSpace(pluginID)
|
|
||||||
if err != nil {
|
|
||||||
c.Fatalf("Could not retrieve plugin ID: %v %s", err, pluginID)
|
|
||||||
}
|
|
||||||
mountpointPrefix := filepath.Join(s.d.RootDir(), "plugins", pluginID, "rootfs")
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if out, err := s.d.Cmd("plugin", "disable", pName); err != nil {
|
if out, err := s.d.Cmd("plugin", "disable", pName); err != nil {
|
||||||
c.Fatalf("Could not disable plugin: %v %s", err, out)
|
c.Fatalf("Could not disable plugin: %v %s", err, out)
|
||||||
|
@ -213,11 +205,6 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
|
||||||
if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
|
if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
|
||||||
c.Fatalf("Could not remove plugin: %v %s", err, out)
|
c.Fatalf("Could not remove plugin: %v %s", err, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
exists, err := existsMountpointWithPrefix(mountpointPrefix)
|
|
||||||
c.Assert(err, checker.IsNil)
|
|
||||||
c.Assert(exists, checker.Equals, false)
|
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
out, err = s.d.Cmd("volume", "create", "-d", pName, volName)
|
out, err = s.d.Cmd("volume", "create", "-d", pName, volName)
|
||||||
|
@ -237,21 +224,11 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
|
||||||
c.Assert(out, checker.Contains, volName)
|
c.Assert(out, checker.Contains, volName)
|
||||||
c.Assert(out, checker.Contains, pName)
|
c.Assert(out, checker.Contains, pName)
|
||||||
|
|
||||||
mountPoint, err := s.d.Cmd("volume", "inspect", volName, "--format", "{{.Mountpoint}}")
|
|
||||||
if err != nil {
|
|
||||||
c.Fatalf("Could not inspect volume: %v %s", err, mountPoint)
|
|
||||||
}
|
|
||||||
mountPoint = strings.TrimSpace(mountPoint)
|
|
||||||
|
|
||||||
out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "touch", destDir+destFile)
|
out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "touch", destDir+destFile)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
c.Assert(err, checker.IsNil, check.Commentf(out))
|
||||||
path := filepath.Join(s.d.RootDir(), "plugins", pluginID, "rootfs", mountPoint, destFile)
|
|
||||||
_, err = os.Lstat(path)
|
|
||||||
c.Assert(err, checker.IsNil)
|
|
||||||
|
|
||||||
exists, err := existsMountpointWithPrefix(mountpointPrefix)
|
out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "ls", destDir+destFile)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil, check.Commentf(out))
|
||||||
c.Assert(exists, checker.Equals, true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerDaemonSuite) TestGraphdriverPlugin(c *check.C) {
|
func (s *DockerDaemonSuite) TestGraphdriverPlugin(c *check.C) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue