mirror of https://github.com/docker/cli.git
cli/command/container: TestNewAttachCommandErrors: use struct-literals
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
229616e173
commit
b711372cab
|
@ -32,10 +32,13 @@ func TestNewAttachCommandErrors(t *testing.T) {
|
||||||
args: []string{"5cb5bb5e4a3b"},
|
args: []string{"5cb5bb5e4a3b"},
|
||||||
expectedError: "You cannot attach to a stopped container",
|
expectedError: "You cannot attach to a stopped container",
|
||||||
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
|
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
|
||||||
c := types.ContainerJSON{}
|
return types.ContainerJSON{
|
||||||
c.ContainerJSONBase = &types.ContainerJSONBase{}
|
ContainerJSONBase: &types.ContainerJSONBase{
|
||||||
c.ContainerJSONBase.State = &types.ContainerState{Running: false}
|
State: &types.ContainerState{
|
||||||
return c, nil
|
Running: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -43,13 +46,14 @@ func TestNewAttachCommandErrors(t *testing.T) {
|
||||||
args: []string{"5cb5bb5e4a3b"},
|
args: []string{"5cb5bb5e4a3b"},
|
||||||
expectedError: "You cannot attach to a paused container",
|
expectedError: "You cannot attach to a paused container",
|
||||||
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
|
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
|
||||||
c := types.ContainerJSON{}
|
return types.ContainerJSON{
|
||||||
c.ContainerJSONBase = &types.ContainerJSONBase{}
|
ContainerJSONBase: &types.ContainerJSONBase{
|
||||||
c.ContainerJSONBase.State = &types.ContainerState{
|
State: &types.ContainerState{
|
||||||
Running: true,
|
Running: true,
|
||||||
Paused: true,
|
Paused: true,
|
||||||
}
|
},
|
||||||
return c, nil
|
},
|
||||||
|
}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -57,14 +61,15 @@ func TestNewAttachCommandErrors(t *testing.T) {
|
||||||
args: []string{"5cb5bb5e4a3b"},
|
args: []string{"5cb5bb5e4a3b"},
|
||||||
expectedError: "You cannot attach to a restarting container",
|
expectedError: "You cannot attach to a restarting container",
|
||||||
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
|
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
|
||||||
c := types.ContainerJSON{}
|
return types.ContainerJSON{
|
||||||
c.ContainerJSONBase = &types.ContainerJSONBase{}
|
ContainerJSONBase: &types.ContainerJSONBase{
|
||||||
c.ContainerJSONBase.State = &types.ContainerState{
|
State: &types.ContainerState{
|
||||||
Running: true,
|
Running: true,
|
||||||
Paused: false,
|
Paused: false,
|
||||||
Restarting: true,
|
Restarting: true,
|
||||||
}
|
},
|
||||||
return c, nil
|
},
|
||||||
|
}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue