LCOW: Remove CommonContainer - just Container
Signed-off-by: John Howard <jhoward@microsoft.com> Upstream-commit: 55f8828eec1ff6c70628a0b6f22bea175ce36159 Component: engine
This commit is contained in:
@@ -38,14 +38,12 @@ func TestHealthStates(t *testing.T) {
|
||||
}
|
||||
|
||||
c := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "id",
|
||||
Name: "name",
|
||||
Config: &containertypes.Config{
|
||||
Image: "image_name",
|
||||
Labels: map[string]string{
|
||||
"com.docker.swarm.task.id": "id",
|
||||
},
|
||||
ID: "id",
|
||||
Name: "name",
|
||||
Config: &containertypes.Config{
|
||||
Image: "image_name",
|
||||
Labels: map[string]string{
|
||||
"com.docker.swarm.task.id": "id",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -27,38 +27,28 @@ import (
|
||||
|
||||
func TestGetContainer(t *testing.T) {
|
||||
c1 := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "5a4ff6a163ad4533d22d69a2b8960bf7fafdcba06e72d2febdba229008b0bf57",
|
||||
Name: "tender_bardeen",
|
||||
},
|
||||
ID: "5a4ff6a163ad4533d22d69a2b8960bf7fafdcba06e72d2febdba229008b0bf57",
|
||||
Name: "tender_bardeen",
|
||||
}
|
||||
|
||||
c2 := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "3cdbd1aa394fd68559fd1441d6eff2ab7c1e6363582c82febfaa8045df3bd8de",
|
||||
Name: "drunk_hawking",
|
||||
},
|
||||
ID: "3cdbd1aa394fd68559fd1441d6eff2ab7c1e6363582c82febfaa8045df3bd8de",
|
||||
Name: "drunk_hawking",
|
||||
}
|
||||
|
||||
c3 := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "3cdbd1aa394fd68559fd1441d6eff2abfafdcba06e72d2febdba229008b0bf57",
|
||||
Name: "3cdbd1aa",
|
||||
},
|
||||
ID: "3cdbd1aa394fd68559fd1441d6eff2abfafdcba06e72d2febdba229008b0bf57",
|
||||
Name: "3cdbd1aa",
|
||||
}
|
||||
|
||||
c4 := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "75fb0b800922abdbef2d27e60abcdfaf7fb0698b2a96d22d3354da361a6ff4a5",
|
||||
Name: "5a4ff6a163ad4533d22d69a2b8960bf7fafdcba06e72d2febdba229008b0bf57",
|
||||
},
|
||||
ID: "75fb0b800922abdbef2d27e60abcdfaf7fb0698b2a96d22d3354da361a6ff4a5",
|
||||
Name: "5a4ff6a163ad4533d22d69a2b8960bf7fafdcba06e72d2febdba229008b0bf57",
|
||||
}
|
||||
|
||||
c5 := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "d22d69a2b8960bf7fafdcba06e72d2febdba960bf7fafdcba06e72d2f9008b060b",
|
||||
Name: "d22d69a2b896",
|
||||
},
|
||||
ID: "d22d69a2b8960bf7fafdcba06e72d2febdba960bf7fafdcba06e72d2f9008b060b",
|
||||
Name: "d22d69a2b896",
|
||||
}
|
||||
|
||||
store := container.NewMemoryStore()
|
||||
@@ -184,7 +174,7 @@ func TestContainerInitDNS(t *testing.T) {
|
||||
"UpdateDns":false,"Volumes":{},"VolumesRW":{},"AppliedVolumesFrom":null}`
|
||||
|
||||
// Container struct only used to retrieve path to config file
|
||||
container := &container.Container{CommonContainer: container.CommonContainer{Root: containerPath}}
|
||||
container := &container.Container{Root: containerPath}
|
||||
configPath, err := container.ConfigPath()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -26,11 +26,9 @@ func newDaemonWithTmpRoot(t *testing.T) (*Daemon, func()) {
|
||||
|
||||
func newContainerWithState(state *container.State) *container.Container {
|
||||
return &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "test",
|
||||
State: state,
|
||||
Config: &containertypes.Config{},
|
||||
},
|
||||
ID: "test",
|
||||
State: state,
|
||||
Config: &containertypes.Config{},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,15 +16,13 @@ func TestLogContainerEventCopyLabels(t *testing.T) {
|
||||
defer e.Evict(l)
|
||||
|
||||
container := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "container_id",
|
||||
Name: "container_name",
|
||||
Config: &containertypes.Config{
|
||||
Image: "image_name",
|
||||
Labels: map[string]string{
|
||||
"node": "1",
|
||||
"os": "alpine",
|
||||
},
|
||||
ID: "container_id",
|
||||
Name: "container_name",
|
||||
Config: &containertypes.Config{
|
||||
Image: "image_name",
|
||||
Labels: map[string]string{
|
||||
"node": "1",
|
||||
"os": "alpine",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -49,14 +47,12 @@ func TestLogContainerEventWithAttributes(t *testing.T) {
|
||||
defer e.Evict(l)
|
||||
|
||||
container := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "container_id",
|
||||
Name: "container_name",
|
||||
Config: &containertypes.Config{
|
||||
Labels: map[string]string{
|
||||
"node": "1",
|
||||
"os": "alpine",
|
||||
},
|
||||
ID: "container_id",
|
||||
Name: "container_name",
|
||||
Config: &containertypes.Config{
|
||||
Labels: map[string]string{
|
||||
"node": "1",
|
||||
"os": "alpine",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -19,17 +19,15 @@ func reset(c *container.Container) {
|
||||
|
||||
func TestNoneHealthcheck(t *testing.T) {
|
||||
c := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "container_id",
|
||||
Name: "container_name",
|
||||
Config: &containertypes.Config{
|
||||
Image: "image_name",
|
||||
Healthcheck: &containertypes.HealthConfig{
|
||||
Test: []string{"NONE"},
|
||||
},
|
||||
ID: "container_id",
|
||||
Name: "container_name",
|
||||
Config: &containertypes.Config{
|
||||
Image: "image_name",
|
||||
Healthcheck: &containertypes.HealthConfig{
|
||||
Test: []string{"NONE"},
|
||||
},
|
||||
State: &container.State{},
|
||||
},
|
||||
State: &container.State{},
|
||||
}
|
||||
daemon := &Daemon{}
|
||||
|
||||
@@ -58,12 +56,10 @@ func TestHealthStates(t *testing.T) {
|
||||
}
|
||||
|
||||
c := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
ID: "container_id",
|
||||
Name: "container_name",
|
||||
Config: &containertypes.Config{
|
||||
Image: "image_name",
|
||||
},
|
||||
ID: "container_id",
|
||||
Name: "container_name",
|
||||
Config: &containertypes.Config{
|
||||
Image: "image_name",
|
||||
},
|
||||
}
|
||||
daemon := &Daemon{
|
||||
|
||||
@@ -18,70 +18,67 @@ func TestBackportMountSpec(t *testing.T) {
|
||||
d := Daemon{containers: container.NewMemoryStore()}
|
||||
|
||||
c := &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
State: &container.State{},
|
||||
MountPoints: map[string]*volume.MountPoint{
|
||||
"/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
|
||||
"/cherry": {Destination: "/cherry", Source: "/var/lib/docker/volumes/data", Name: "data", CopyData: true}, // RO named volume
|
||||
"/dates": {Destination: "/dates", Source: "/var/lib/docker/volumes/data", Name: "data"}, // named volume nocopy
|
||||
"/elderberry": {Destination: "/elderberry", Source: "/var/lib/docker/volumes/data", Name: "data"}, // masks anon vol
|
||||
"/fig": {Destination: "/fig", Source: "/data", RW: true}, // RW bind
|
||||
"/guava": {Destination: "/guava", Source: "/data", RW: false, Propagation: "shared"}, // RO bind + propagation
|
||||
"/kumquat": {Destination: "/kumquat", Name: "data", RW: false, CopyData: true}, // volumes-from
|
||||
State: &container.State{},
|
||||
MountPoints: map[string]*volume.MountPoint{
|
||||
"/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
|
||||
"/cherry": {Destination: "/cherry", Source: "/var/lib/docker/volumes/data", Name: "data", CopyData: true}, // RO named volume
|
||||
"/dates": {Destination: "/dates", Source: "/var/lib/docker/volumes/data", Name: "data"}, // named volume nocopy
|
||||
"/elderberry": {Destination: "/elderberry", Source: "/var/lib/docker/volumes/data", Name: "data"}, // masks anon vol
|
||||
"/fig": {Destination: "/fig", Source: "/data", RW: true}, // RW bind
|
||||
"/guava": {Destination: "/guava", Source: "/data", RW: false, Propagation: "shared"}, // RO bind + propagation
|
||||
"/kumquat": {Destination: "/kumquat", Name: "data", RW: false, CopyData: true}, // volumes-from
|
||||
|
||||
// partially configured mountpoint due to #32613
|
||||
// specifically, `mp.Spec.Source` is not set
|
||||
"/honeydew": {
|
||||
Type: mounttypes.TypeVolume,
|
||||
Destination: "/honeydew",
|
||||
Name: "data",
|
||||
Source: "/var/lib/docker/volumes/data",
|
||||
Spec: mounttypes.Mount{Type: mounttypes.TypeVolume, Target: "/honeydew", VolumeOptions: &mounttypes.VolumeOptions{NoCopy: true}},
|
||||
},
|
||||
// partially configured mountpoint due to #32613
|
||||
// specifically, `mp.Spec.Source` is not set
|
||||
"/honeydew": {
|
||||
Type: mounttypes.TypeVolume,
|
||||
Destination: "/honeydew",
|
||||
Name: "data",
|
||||
Source: "/var/lib/docker/volumes/data",
|
||||
Spec: mounttypes.Mount{Type: mounttypes.TypeVolume, Target: "/honeydew", VolumeOptions: &mounttypes.VolumeOptions{NoCopy: true}},
|
||||
},
|
||||
|
||||
// from hostconfig.Mounts
|
||||
"/jambolan": {
|
||||
Type: mounttypes.TypeVolume,
|
||||
Destination: "/jambolan",
|
||||
Source: "/var/lib/docker/volumes/data",
|
||||
RW: true,
|
||||
Name: "data",
|
||||
Spec: mounttypes.Mount{Type: mounttypes.TypeVolume, Target: "/jambolan", Source: "data"},
|
||||
},
|
||||
// from hostconfig.Mounts
|
||||
"/jambolan": {
|
||||
Type: mounttypes.TypeVolume,
|
||||
Destination: "/jambolan",
|
||||
Source: "/var/lib/docker/volumes/data",
|
||||
RW: true,
|
||||
Name: "data",
|
||||
Spec: mounttypes.Mount{Type: mounttypes.TypeVolume, Target: "/jambolan", Source: "data"},
|
||||
},
|
||||
HostConfig: &containertypes.HostConfig{
|
||||
Binds: []string{
|
||||
"data:/banana",
|
||||
"data:/cherry:ro",
|
||||
"data:/dates:ro,nocopy",
|
||||
"data:/elderberry:ro,nocopy",
|
||||
"/data:/fig",
|
||||
"/data:/guava:ro,shared",
|
||||
"data:/honeydew:nocopy",
|
||||
},
|
||||
VolumesFrom: []string{"1:ro"},
|
||||
Mounts: []mounttypes.Mount{
|
||||
{Type: mounttypes.TypeVolume, Target: "/jambolan"},
|
||||
},
|
||||
},
|
||||
HostConfig: &containertypes.HostConfig{
|
||||
Binds: []string{
|
||||
"data:/banana",
|
||||
"data:/cherry:ro",
|
||||
"data:/dates:ro,nocopy",
|
||||
"data:/elderberry:ro,nocopy",
|
||||
"/data:/fig",
|
||||
"/data:/guava:ro,shared",
|
||||
"data:/honeydew:nocopy",
|
||||
},
|
||||
Config: &containertypes.Config{Volumes: map[string]struct{}{
|
||||
"/apple": {},
|
||||
"/elderberry": {},
|
||||
}},
|
||||
}}
|
||||
VolumesFrom: []string{"1:ro"},
|
||||
Mounts: []mounttypes.Mount{
|
||||
{Type: mounttypes.TypeVolume, Target: "/jambolan"},
|
||||
},
|
||||
},
|
||||
Config: &containertypes.Config{Volumes: map[string]struct{}{
|
||||
"/apple": {},
|
||||
"/elderberry": {},
|
||||
}},
|
||||
}
|
||||
|
||||
d.containers.Add("1", &container.Container{
|
||||
CommonContainer: container.CommonContainer{
|
||||
State: &container.State{},
|
||||
ID: "1",
|
||||
MountPoints: map[string]*volume.MountPoint{
|
||||
"/kumquat": {Destination: "/kumquat", Name: "data", RW: false, CopyData: true},
|
||||
},
|
||||
HostConfig: &containertypes.HostConfig{
|
||||
Binds: []string{
|
||||
"data:/kumquat:ro",
|
||||
},
|
||||
State: &container.State{},
|
||||
ID: "1",
|
||||
MountPoints: map[string]*volume.MountPoint{
|
||||
"/kumquat": {Destination: "/kumquat", Name: "data", RW: false, CopyData: true},
|
||||
},
|
||||
HostConfig: &containertypes.HostConfig{
|
||||
Binds: []string{
|
||||
"data:/kumquat:ro",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user