Browse code

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>

Brian Goff authored on 2018/02/21 06:57:20
Showing 1 changed files
... ...
@@ -3,8 +3,6 @@
3 3
 package main
4 4
 
5 5
 import (
6
-	"os"
7
-	"path/filepath"
8 6
 	"strings"
9 7
 
10 8
 	"github.com/docker/docker/integration-cli/checker"
... ...
@@ -199,12 +197,6 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
199 199
 	if err != nil {
200 200
 		c.Fatalf("Could not install plugin: %v %s", err, out)
201 201
 	}
202
-	pluginID, err := s.d.Cmd("plugin", "inspect", "-f", "{{.Id}}", pName)
203
-	pluginID = strings.TrimSpace(pluginID)
204
-	if err != nil {
205
-		c.Fatalf("Could not retrieve plugin ID: %v %s", err, pluginID)
206
-	}
207
-	mountpointPrefix := filepath.Join(s.d.RootDir(), "plugins", pluginID, "rootfs")
208 202
 	defer func() {
209 203
 		if out, err := s.d.Cmd("plugin", "disable", pName); err != nil {
210 204
 			c.Fatalf("Could not disable plugin: %v %s", err, out)
... ...
@@ -213,11 +205,6 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
213 213
 		if out, err := s.d.Cmd("plugin", "remove", pName); err != nil {
214 214
 			c.Fatalf("Could not remove plugin: %v %s", err, out)
215 215
 		}
216
-
217
-		exists, err := existsMountpointWithPrefix(mountpointPrefix)
218
-		c.Assert(err, checker.IsNil)
219
-		c.Assert(exists, checker.Equals, false)
220
-
221 216
 	}()
222 217
 
223 218
 	out, err = s.d.Cmd("volume", "create", "-d", pName, volName)
... ...
@@ -237,21 +224,11 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
237 237
 	c.Assert(out, checker.Contains, volName)
238 238
 	c.Assert(out, checker.Contains, pName)
239 239
 
240
-	mountPoint, err := s.d.Cmd("volume", "inspect", volName, "--format", "{{.Mountpoint}}")
241
-	if err != nil {
242
-		c.Fatalf("Could not inspect volume: %v %s", err, mountPoint)
243
-	}
244
-	mountPoint = strings.TrimSpace(mountPoint)
245
-
246 240
 	out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "touch", destDir+destFile)
247 241
 	c.Assert(err, checker.IsNil, check.Commentf(out))
248
-	path := filepath.Join(s.d.RootDir(), "plugins", pluginID, "rootfs", mountPoint, destFile)
249
-	_, err = os.Lstat(path)
250
-	c.Assert(err, checker.IsNil)
251 242
 
252
-	exists, err := existsMountpointWithPrefix(mountpointPrefix)
253
-	c.Assert(err, checker.IsNil)
254
-	c.Assert(exists, checker.Equals, true)
243
+	out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "ls", destDir+destFile)
244
+	c.Assert(err, checker.IsNil, check.Commentf(out))
255 245
 }
256 246
 
257 247
 func (s *DockerDaemonSuite) TestGraphdriverPlugin(c *check.C) {