|
@@ -11,7 +11,7 @@ import (
|
|
containertypes "github.com/docker/docker/api/types/container"
|
|
containertypes "github.com/docker/docker/api/types/container"
|
|
mounttypes "github.com/docker/docker/api/types/mount"
|
|
mounttypes "github.com/docker/docker/api/types/mount"
|
|
"github.com/docker/docker/container"
|
|
"github.com/docker/docker/container"
|
|
- "github.com/docker/docker/volume"
|
|
|
|
|
|
+ volumemounts "github.com/docker/docker/volume/mounts"
|
|
)
|
|
)
|
|
|
|
|
|
func TestBackportMountSpec(t *testing.T) {
|
|
func TestBackportMountSpec(t *testing.T) {
|
|
@@ -19,7 +19,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
|
|
|
|
c := &container.Container{
|
|
c := &container.Container{
|
|
State: &container.State{},
|
|
State: &container.State{},
|
|
- MountPoints: map[string]*volume.MountPoint{
|
|
|
|
|
|
+ MountPoints: map[string]*volumemounts.MountPoint{
|
|
"/apple": {Destination: "/apple", Source: "/var/lib/docker/volumes/12345678", Name: "12345678", RW: true, CopyData: true}, // anonymous volume
|
|
"/apple": {Destination: "/apple", Source: "/var/lib/docker/volumes/12345678", Name: "12345678", RW: true, CopyData: true}, // anonymous volume
|
|
"/banana": {Destination: "/banana", Source: "/var/lib/docker/volumes/data", Name: "data", RW: true, CopyData: true}, // named volume
|
|
"/banana": {Destination: "/banana", Source: "/var/lib/docker/volumes/data", Name: "data", RW: true, CopyData: true}, // named volume
|
|
"/cherry": {Destination: "/cherry", Source: "/var/lib/docker/volumes/data", Name: "data", CopyData: true}, // RO named volume
|
|
"/cherry": {Destination: "/cherry", Source: "/var/lib/docker/volumes/data", Name: "data", CopyData: true}, // RO named volume
|
|
@@ -73,7 +73,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
d.containers.Add("1", &container.Container{
|
|
d.containers.Add("1", &container.Container{
|
|
State: &container.State{},
|
|
State: &container.State{},
|
|
ID: "1",
|
|
ID: "1",
|
|
- MountPoints: map[string]*volume.MountPoint{
|
|
|
|
|
|
+ MountPoints: map[string]*volumemounts.MountPoint{
|
|
"/kumquat": {Destination: "/kumquat", Name: "data", RW: false, CopyData: true},
|
|
"/kumquat": {Destination: "/kumquat", Name: "data", RW: false, CopyData: true},
|
|
},
|
|
},
|
|
HostConfig: &containertypes.HostConfig{
|
|
HostConfig: &containertypes.HostConfig{
|
|
@@ -84,11 +84,11 @@ func TestBackportMountSpec(t *testing.T) {
|
|
})
|
|
})
|
|
|
|
|
|
type expected struct {
|
|
type expected struct {
|
|
- mp *volume.MountPoint
|
|
|
|
|
|
+ mp *volumemounts.MountPoint
|
|
comment string
|
|
comment string
|
|
}
|
|
}
|
|
|
|
|
|
- pretty := func(mp *volume.MountPoint) string {
|
|
|
|
|
|
+ pretty := func(mp *volumemounts.MountPoint) string {
|
|
b, err := json.MarshalIndent(mp, "\t", " ")
|
|
b, err := json.MarshalIndent(mp, "\t", " ")
|
|
if err != nil {
|
|
if err != nil {
|
|
return fmt.Sprintf("%#v", mp)
|
|
return fmt.Sprintf("%#v", mp)
|
|
@@ -98,7 +98,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
|
|
|
|
for _, x := range []expected{
|
|
for _, x := range []expected{
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeVolume,
|
|
Type: mounttypes.TypeVolume,
|
|
Destination: "/apple",
|
|
Destination: "/apple",
|
|
RW: true,
|
|
RW: true,
|
|
@@ -114,7 +114,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
comment: "anonymous volume",
|
|
comment: "anonymous volume",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeVolume,
|
|
Type: mounttypes.TypeVolume,
|
|
Destination: "/banana",
|
|
Destination: "/banana",
|
|
RW: true,
|
|
RW: true,
|
|
@@ -130,7 +130,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
comment: "named volume",
|
|
comment: "named volume",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeVolume,
|
|
Type: mounttypes.TypeVolume,
|
|
Destination: "/cherry",
|
|
Destination: "/cherry",
|
|
Name: "data",
|
|
Name: "data",
|
|
@@ -146,7 +146,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
comment: "read-only named volume",
|
|
comment: "read-only named volume",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeVolume,
|
|
Type: mounttypes.TypeVolume,
|
|
Destination: "/dates",
|
|
Destination: "/dates",
|
|
Name: "data",
|
|
Name: "data",
|
|
@@ -162,7 +162,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
comment: "named volume with nocopy",
|
|
comment: "named volume with nocopy",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeVolume,
|
|
Type: mounttypes.TypeVolume,
|
|
Destination: "/elderberry",
|
|
Destination: "/elderberry",
|
|
Name: "data",
|
|
Name: "data",
|
|
@@ -178,7 +178,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
comment: "masks an anonymous volume",
|
|
comment: "masks an anonymous volume",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeBind,
|
|
Type: mounttypes.TypeBind,
|
|
Destination: "/fig",
|
|
Destination: "/fig",
|
|
Source: "/data",
|
|
Source: "/data",
|
|
@@ -192,7 +192,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
comment: "bind mount with read/write",
|
|
comment: "bind mount with read/write",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeBind,
|
|
Type: mounttypes.TypeBind,
|
|
Destination: "/guava",
|
|
Destination: "/guava",
|
|
Source: "/data",
|
|
Source: "/data",
|
|
@@ -209,7 +209,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
comment: "bind mount with read/write + shared propagation",
|
|
comment: "bind mount with read/write + shared propagation",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeVolume,
|
|
Type: mounttypes.TypeVolume,
|
|
Destination: "/honeydew",
|
|
Destination: "/honeydew",
|
|
Source: "/var/lib/docker/volumes/data",
|
|
Source: "/var/lib/docker/volumes/data",
|
|
@@ -229,7 +229,7 @@ func TestBackportMountSpec(t *testing.T) {
|
|
comment: "volume defined in mounts API",
|
|
comment: "volume defined in mounts API",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- mp: &volume.MountPoint{
|
|
|
|
|
|
+ mp: &volumemounts.MountPoint{
|
|
Type: mounttypes.TypeVolume,
|
|
Type: mounttypes.TypeVolume,
|
|
Destination: "/kumquat",
|
|
Destination: "/kumquat",
|
|
Source: "/var/lib/docker/volumes/data",
|
|
Source: "/var/lib/docker/volumes/data",
|