Do not kill all on task delete by default
- Still KillAll if the task uses the hosts pid namespace - Test for both host pid namespace and normal cases Co-authored-by: Oliver Stenbom <ostenbom@pivotal.io> Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com> Signed-off-by: Oliver Stenbom <ostenbom@pivotal.io>
This commit is contained in:

committed by
Oliver Stenbom

parent
0649e38c57
commit
b5ccc66c2c
@@ -1040,7 +1040,7 @@ func TestContainerRuntimeOptionsv2(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestContainerKillInitPidHost(t *testing.T) {
|
||||
func initContainerAndCheckChildrenDieOnKill(t *testing.T, opts ...oci.SpecOpts) {
|
||||
client, err := newClient(t, address)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -1059,12 +1059,12 @@ func TestContainerKillInitPidHost(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
opts = append(opts, oci.WithImageConfig(image))
|
||||
opts = append(opts, withProcessArgs("sh", "-c", "sleep 42; echo hi"))
|
||||
|
||||
container, err := client.NewContainer(ctx, id,
|
||||
WithNewSnapshot(id, image),
|
||||
WithNewSpec(oci.WithImageConfig(image),
|
||||
withProcessArgs("sh", "-c", "sleep 42; echo hi"),
|
||||
oci.WithHostNamespace(specs.PIDNamespace),
|
||||
),
|
||||
WithNewSpec(opts...),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -1111,6 +1111,14 @@ func TestContainerKillInitPidHost(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestContainerKillInitPidHost(t *testing.T) {
|
||||
initContainerAndCheckChildrenDieOnKill(t, oci.WithHostNamespace(specs.PIDNamespace))
|
||||
}
|
||||
|
||||
func TestContainerKillInitKillsChildWhenNotHostPid(t *testing.T) {
|
||||
initContainerAndCheckChildrenDieOnKill(t)
|
||||
}
|
||||
|
||||
func TestUserNamespaces(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("WritableRootFS", func(t *testing.T) { testUserNamespaces(t, false) })
|
||||
|
Reference in New Issue
Block a user