summaryrefslogtreecommitdiff
path: root/daemon/daemon_unix_test.go
diff options
context:
space:
mode:
authorBrian Goff <cpuguy83@gmail.com>2018-03-19 17:14:00 -0400
committerBrian Goff <cpuguy83@gmail.com>2018-04-17 14:06:53 -0400
commit0023abbad34282762d5bd17302776d2a8521fffc (patch)
tree7d819ee8281fc62ae0ed432a66d61c19c0bc9ae4 /daemon/daemon_unix_test.go
parent63826e291ba3b88443b64802084bbb3931857b56 (diff)
downloaddocker-0023abbad34282762d5bd17302776d2a8521fffc.tar.gz
Remove old/uneeded volume migration from vers 1.7
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Diffstat (limited to 'daemon/daemon_unix_test.go')
-rw-r--r--daemon/daemon_unix_test.go89
1 files changed, 0 insertions, 89 deletions
diff --git a/daemon/daemon_unix_test.go b/daemon/daemon_unix_test.go
index 84281c0b8c..36c6030988 100644
--- a/daemon/daemon_unix_test.go
+++ b/daemon/daemon_unix_test.go
@@ -6,18 +6,11 @@ import (
"errors"
"io/ioutil"
"os"
- "path/filepath"
"testing"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/container"
"github.com/docker/docker/daemon/config"
- "github.com/docker/docker/pkg/idtools"
- "github.com/docker/docker/volume"
- "github.com/docker/docker/volume/drivers"
- "github.com/docker/docker/volume/local"
- "github.com/docker/docker/volume/store"
- "github.com/gotestyourself/gotestyourself/assert"
)
type fakeContainerGetter struct {
@@ -273,85 +266,3 @@ func TestNetworkOptions(t *testing.T) {
t.Fatal("Expected networkOptions error, got nil")
}
}
-
-func TestMigratePre17Volumes(t *testing.T) {
- rootDir, err := ioutil.TempDir("", "test-daemon-volumes")
- if err != nil {
- t.Fatal(err)
- }
- defer os.RemoveAll(rootDir)
-
- volumeRoot := filepath.Join(rootDir, "volumes")
- err = os.MkdirAll(volumeRoot, 0755)
- if err != nil {
- t.Fatal(err)
- }
-
- containerRoot := filepath.Join(rootDir, "containers")
- cid := "1234"
- err = os.MkdirAll(filepath.Join(containerRoot, cid), 0755)
- assert.NilError(t, err)
-
- vid := "5678"
- vfsPath := filepath.Join(rootDir, "vfs", "dir", vid)
- err = os.MkdirAll(vfsPath, 0755)
- assert.NilError(t, err)
-
- config := []byte(`
- {
- "ID": "` + cid + `",
- "Volumes": {
- "/foo": "` + vfsPath + `",
- "/bar": "/foo",
- "/quux": "/quux"
- },
- "VolumesRW": {
- "/foo": true,
- "/bar": true,
- "/quux": false
- }
- }
- `)
-
- volStore, err := store.New(volumeRoot)
- if err != nil {
- t.Fatal(err)
- }
- drv, err := local.New(volumeRoot, idtools.IDPair{UID: 0, GID: 0})
- if err != nil {
- t.Fatal(err)
- }
- volumedrivers.Register(drv, volume.DefaultDriverName)
-
- daemon := &Daemon{
- root: rootDir,
- repository: containerRoot,
- volumes: volStore,
- }
- err = ioutil.WriteFile(filepath.Join(containerRoot, cid, "config.v2.json"), config, 600)
- if err != nil {
- t.Fatal(err)
- }
- c, err := daemon.load(cid)
- if err != nil {
- t.Fatal(err)
- }
- if err := daemon.verifyVolumesInfo(c); err != nil {
- t.Fatal(err)
- }
-
- expected := map[string]volume.MountPoint{
- "/foo": {Destination: "/foo", RW: true, Name: vid},
- "/bar": {Source: "/foo", Destination: "/bar", RW: true},
- "/quux": {Source: "/quux", Destination: "/quux", RW: false},
- }
- for id, mp := range c.MountPoints {
- x, exists := expected[id]
- if !exists {
- t.Fatal("volume not migrated")
- }
- if mp.Source != x.Source || mp.Destination != x.Destination || mp.RW != x.RW || mp.Name != x.Name {
- t.Fatalf("got unexpected mountpoint, expected: %+v, got: %+v", x, mp)
- }
- }
-}