diff --git a/libcontainer/integration/exec_test.go b/libcontainer/integration/exec_test.go index c13624446..5bfec5d73 100644 --- a/libcontainer/integration/exec_test.go +++ b/libcontainer/integration/exec_test.go @@ -1373,9 +1373,7 @@ func testPidnsInitKill(t *testing.T, config *configs.Config) { // Run a container with two long-running processes. container, err := newContainer(t, config) ok(t, err) - defer func() { - _ = container.Destroy() - }() + defer destroyContainer(container) process1 := &libcontainer.Process{ Cwd: "/", @@ -1796,7 +1794,7 @@ func TestBindMountAndUser(t *testing.T) { container, err := newContainer(t, config) ok(t, err) - defer container.Destroy() //nolint: errcheck + defer destroyContainer(container) var stdout bytes.Buffer diff --git a/libcontainer/integration/seccomp_test.go b/libcontainer/integration/seccomp_test.go index 1ca13ebcf..4e8e0912a 100644 --- a/libcontainer/integration/seccomp_test.go +++ b/libcontainer/integration/seccomp_test.go @@ -33,7 +33,7 @@ func TestSeccompDenySyslogWithErrno(t *testing.T) { container, err := newContainer(t, config) ok(t, err) - defer container.Destroy() //nolint:errcheck + defer destroyContainer(container) buffers := newStdBuffers() pwd := &libcontainer.Process{ @@ -81,7 +81,7 @@ func TestSeccompDenySyslog(t *testing.T) { container, err := newContainer(t, config) ok(t, err) - defer container.Destroy() //nolint:errcheck + defer destroyContainer(container) buffers := newStdBuffers() pwd := &libcontainer.Process{ @@ -136,7 +136,7 @@ func TestSeccompPermitWriteConditional(t *testing.T) { container, err := newContainer(t, config) ok(t, err) - defer container.Destroy() //nolint:errcheck + defer destroyContainer(container) buffers := newStdBuffers() dmesg := &libcontainer.Process{ @@ -188,7 +188,7 @@ func TestSeccompDenyWriteConditional(t *testing.T) { container, err := newContainer(t, config) ok(t, err) - defer container.Destroy() //nolint:errcheck + defer destroyContainer(container) buffers := newStdBuffers() dmesg := &libcontainer.Process{