types: split sandbox and container state

Since they do not really share many of the fields.

Fixes: #1434

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao
2019-04-08 23:36:59 -07:00
parent 4265509e9c
commit 616f26cfe5
24 changed files with 163 additions and 115 deletions

View File

@@ -78,7 +78,7 @@ func TestExecuteErrors(t *testing.T) {
}
testingImpl.StatusContainerFunc = func(ctx context.Context, sandboxID, containerID string) (vc.ContainerStatus, error) {
return newSingleContainerStatus(testContainerID, types.State{}, annotations), nil
return newSingleContainerStatus(testContainerID, types.ContainerState{}, annotations), nil
}
defer func() {
@@ -100,7 +100,7 @@ func TestExecuteErrors(t *testing.T) {
vcAnnotations.ConfigJSONKey: configJSON,
}
containerState := types.State{}
containerState := types.ContainerState{}
testingImpl.StatusContainerFunc = func(ctx context.Context, sandboxID, containerID string) (vc.ContainerStatus, error) {
return newSingleContainerStatus(testContainerID, containerState, annotations), nil
}
@@ -110,7 +110,7 @@ func TestExecuteErrors(t *testing.T) {
assert.False(vcmock.IsMockError(err))
// Container paused
containerState = types.State{
containerState = types.ContainerState{
State: types.StatePaused,
}
testingImpl.StatusContainerFunc = func(ctx context.Context, sandboxID, containerID string) (vc.ContainerStatus, error) {
@@ -122,7 +122,7 @@ func TestExecuteErrors(t *testing.T) {
assert.False(vcmock.IsMockError(err))
// Container stopped
containerState = types.State{
containerState = types.ContainerState{
State: types.StateStopped,
}
testingImpl.StatusContainerFunc = func(ctx context.Context, sandboxID, containerID string) (vc.ContainerStatus, error) {
@@ -159,7 +159,7 @@ func TestExecuteErrorReadingProcessJson(t *testing.T) {
vcAnnotations.ConfigJSONKey: configJSON,
}
state := types.State{
state := types.ContainerState{
State: types.StateRunning,
}
@@ -208,7 +208,7 @@ func TestExecuteErrorOpeningConsole(t *testing.T) {
vcAnnotations.ConfigJSONKey: configJSON,
}
state := types.State{
state := types.ContainerState{
State: types.StateRunning,
}
@@ -275,7 +275,7 @@ func TestExecuteWithFlags(t *testing.T) {
vcAnnotations.ConfigJSONKey: configJSON,
}
state := types.State{
state := types.ContainerState{
State: types.StateRunning,
}
@@ -365,7 +365,7 @@ func TestExecuteWithFlagsDetached(t *testing.T) {
vcAnnotations.ConfigJSONKey: configJSON,
}
state := types.State{
state := types.ContainerState{
State: types.StateRunning,
}
@@ -444,7 +444,7 @@ func TestExecuteWithInvalidProcessJson(t *testing.T) {
vcAnnotations.ConfigJSONKey: configJSON,
}
state := types.State{
state := types.ContainerState{
State: types.StateRunning,
}
@@ -496,7 +496,7 @@ func TestExecuteWithValidProcessJson(t *testing.T) {
vcAnnotations.ConfigJSONKey: configJSON,
}
state := types.State{
state := types.ContainerState{
State: types.StateRunning,
}
@@ -597,7 +597,7 @@ func TestExecuteWithEmptyEnvironmentValue(t *testing.T) {
vcAnnotations.ConfigJSONKey: configJSON,
}
state := types.State{
state := types.ContainerState{
State: types.StateRunning,
}