github.com/jwhonce/docker@v0.6.7-0.20190327063223-da823cf3a5a3/integration/plugin/volumes/mounts_test.go (about) 1 package volumes 2 3 import ( 4 "context" 5 "io/ioutil" 6 "os" 7 "testing" 8 9 "github.com/docker/docker/api/types" 10 "github.com/docker/docker/internal/test/daemon" 11 "github.com/docker/docker/internal/test/fixtures/plugin" 12 "gotest.tools/assert" 13 "gotest.tools/skip" 14 ) 15 16 // TestPluginWithDevMounts tests very specific regression caused by mounts ordering 17 // (sorted in the daemon). See #36698 18 func TestPluginWithDevMounts(t *testing.T) { 19 skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") 20 skip.If(t, testEnv.DaemonInfo.OSType == "windows") 21 t.Parallel() 22 23 d := daemon.New(t) 24 d.Start(t, "--iptables=false") 25 defer d.Stop(t) 26 27 c := d.NewClientT(t) 28 ctx := context.Background() 29 30 testDir, err := ioutil.TempDir("", "test-dir") 31 assert.NilError(t, err) 32 defer os.RemoveAll(testDir) 33 34 createPlugin(t, c, "test", "dummy", asVolumeDriver, func(c *plugin.Config) { 35 root := "/" 36 dev := "/dev" 37 mounts := []types.PluginMount{ 38 {Type: "bind", Source: &root, Destination: "/host", Options: []string{"rbind"}}, 39 {Type: "bind", Source: &dev, Destination: "/dev", Options: []string{"rbind"}}, 40 {Type: "bind", Source: &testDir, Destination: "/etc/foo", Options: []string{"rbind"}}, 41 } 42 c.PluginConfig.Mounts = append(c.PluginConfig.Mounts, mounts...) 43 c.PropagatedMount = "/propagated" 44 c.Network = types.PluginConfigNetwork{Type: "host"} 45 c.IpcHost = true 46 }) 47 48 err = c.PluginEnable(ctx, "test", types.PluginEnableOptions{Timeout: 30}) 49 assert.NilError(t, err) 50 defer func() { 51 err := c.PluginRemove(ctx, "test", types.PluginRemoveOptions{Force: true}) 52 assert.Check(t, err) 53 }() 54 55 p, _, err := c.PluginInspectWithRaw(ctx, "test") 56 assert.NilError(t, err) 57 assert.Assert(t, p.Enabled) 58 }