From 09504471060fb1bbe875485e64025a864a20db0f Mon Sep 17 00:00:00 2001 From: Daniel Canter Date: Sat, 13 Aug 2022 07:46:53 -0700 Subject: [PATCH] Remove Windows special case in TestContainerdRestart Previously in the Windows shim, killing a task that has already exited or a task that has not yet been started, yielded an ErrNotFound. We now return nil, which is in line with how the linux runtime behaves, so remove the special case we had in TestContainerdRestart for this. Signed-off-by: Daniel Canter --- integration/restart_test.go | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/integration/restart_test.go b/integration/restart_test.go index 16ac5c8b6..f738cc402 100644 --- a/integration/restart_test.go +++ b/integration/restart_test.go @@ -25,7 +25,6 @@ import ( "time" "github.com/containerd/containerd" - "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/integration/images" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -143,25 +142,12 @@ func TestContainerdRestart(t *testing.T) { require.NoError(t, err) err = task.Kill(ctx, syscall.SIGKILL, containerd.WithKillAll) - if goruntime.GOOS != "windows" { - // NOTE: CRI-plugin setups watcher for each container and - // cleanups container when the watcher returns exit event. - // We just need to kill that sandbox and wait for exit - // event from waitCh. If the sandbox container exits, - // the state of sandbox must be NOT_READY. - require.NoError(t, err) - } else { - // NOTE(gabriel-samfira): On Windows, the "notready-sandbox" array - // only has a container in the ContainerState_CONTAINER_CREATED - // state and a container in the ContainerState_CONTAINER_EXITED state. - // Sending a Kill() to a task that has already exited, or to a task that - // was never started (which is the case here), will always return an - // ErrorNotFound (at least on Windows). Given that in this sanbox, there - // will never be a running task, after we recover from a containerd restart - // we can expect an ErrorNotFound here every time. - // The waitCh channel should already be closed at this point. - assert.True(t, errdefs.IsNotFound(err), err) - } + // NOTE: CRI-plugin setups watcher for each container and + // cleanups container when the watcher returns exit event. + // We just need to kill that sandbox and wait for exit + // event from waitCh. If the sandbox container exits, + // the state of sandbox must be NOT_READY. + require.NoError(t, err) select { case <-waitCh: