mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-06 07:54:22 +01:00
exec: Allow to exec a process on a ready container
If a container is not running, but created/ready instead, this means a container process exists and that we can actually exec another process inside this container. The container does not have to be in running state. Fixes #120 Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -336,3 +336,29 @@ func TestContainerRemoveResources(t *testing.T) {
|
||||
err = c.removeResources()
|
||||
assert.Nil(err)
|
||||
}
|
||||
|
||||
func TestContainerEnterErrorsOnContainerStates(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
c := &Container{
|
||||
pod: &Pod{
|
||||
state: State{
|
||||
State: StateRunning,
|
||||
},
|
||||
},
|
||||
}
|
||||
cmd := Cmd{}
|
||||
|
||||
// Container state undefined
|
||||
_, err := c.enter(cmd)
|
||||
assert.Error(err)
|
||||
|
||||
// Container paused
|
||||
c.state.State = StatePaused
|
||||
_, err = c.enter(cmd)
|
||||
assert.Error(err)
|
||||
|
||||
// Container stopped
|
||||
c.state.State = StateStopped
|
||||
_, err = c.enter(cmd)
|
||||
assert.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user