Allow image and snapshotkey to be updated
This allows a container's image and snapshot key to be updated via the Update APIs. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -263,29 +263,6 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
|
||||
fieldpaths: []string{"runtime"},
|
||||
cause: errdefs.ErrInvalidArgument,
|
||||
},
|
||||
{
|
||||
name: "UpdateFail",
|
||||
original: containers.Container{
|
||||
Spec: encoded,
|
||||
SnapshotKey: "test-snapshot-key",
|
||||
Snapshotter: "snapshotter",
|
||||
|
||||
Runtime: containers.RuntimeInfo{
|
||||
Name: "testruntime",
|
||||
},
|
||||
Image: "test image",
|
||||
},
|
||||
input: containers.Container{
|
||||
Spec: encoded,
|
||||
Runtime: containers.RuntimeInfo{
|
||||
Name: "testruntime",
|
||||
},
|
||||
SnapshotKey: "test-snapshot-key",
|
||||
Snapshotter: "snapshotter",
|
||||
// try to clear image field
|
||||
},
|
||||
cause: errdefs.ErrInvalidArgument,
|
||||
},
|
||||
{
|
||||
name: "UpdateSpec",
|
||||
original: containers.Container{
|
||||
@@ -311,6 +288,60 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
|
||||
Image: "test image",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "UpdateSnapshot",
|
||||
original: containers.Container{
|
||||
|
||||
Spec: encoded,
|
||||
SnapshotKey: "test-snapshot-key",
|
||||
Snapshotter: "snapshotter",
|
||||
Runtime: containers.RuntimeInfo{
|
||||
Name: "testruntime",
|
||||
},
|
||||
Image: "test image",
|
||||
},
|
||||
input: containers.Container{
|
||||
SnapshotKey: "test2-snapshot-key",
|
||||
},
|
||||
fieldpaths: []string{"snapshotkey"},
|
||||
expected: containers.Container{
|
||||
|
||||
Spec: encoded,
|
||||
SnapshotKey: "test2-snapshot-key",
|
||||
Snapshotter: "snapshotter",
|
||||
Runtime: containers.RuntimeInfo{
|
||||
Name: "testruntime",
|
||||
},
|
||||
Image: "test image",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "UpdateImage",
|
||||
original: containers.Container{
|
||||
|
||||
Spec: encoded,
|
||||
SnapshotKey: "test-snapshot-key",
|
||||
Snapshotter: "snapshotter",
|
||||
Runtime: containers.RuntimeInfo{
|
||||
Name: "testruntime",
|
||||
},
|
||||
Image: "test image",
|
||||
},
|
||||
input: containers.Container{
|
||||
Image: "test2 image",
|
||||
},
|
||||
fieldpaths: []string{"image"},
|
||||
expected: containers.Container{
|
||||
|
||||
Spec: encoded,
|
||||
SnapshotKey: "test-snapshot-key",
|
||||
Snapshotter: "snapshotter",
|
||||
Runtime: containers.RuntimeInfo{
|
||||
Name: "testruntime",
|
||||
},
|
||||
Image: "test2 image",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "UpdateLabel",
|
||||
original: containers.Container{
|
||||
|
||||
Reference in New Issue
Block a user