Skip to content

Commit

Permalink
Integration test task.Delete fix
Browse files Browse the repository at this point in the history
task.Delete() will try to kill the task before delete it,
but once the task is killed, the TaskExit event will also
tigger another task.Delete() which would conflict with this
test task.Delete(). To avoid this conflict, kill the task instead
of Delete it, and let TaskExit trigger task.Delete().

Signed-off-by: lifupan <lifupan@gmail.com>
  • Loading branch information
lifupan committed May 8, 2019
1 parent 82ff937 commit 47fc645
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion integration/sandbox_clean_remove_test.go
Expand Up @@ -21,6 +21,7 @@ import (
"os"
"path/filepath"
"strings"
"syscall"
"testing"
"time"

Expand Down Expand Up @@ -53,7 +54,9 @@ func TestSandboxCleanRemove(t *testing.T) {
require.NoError(t, err)
task, err := cntr.Task(ctx, nil)
require.NoError(t, err)
_, err = task.Delete(ctx, containerd.WithProcessKill)
// Kill the task with signal SIGKILL, once the task exited,
// the TaskExit event will trigger the task.Delete().
err = task.Kill(ctx, syscall.SIGKILL, containerd.WithKillAll)
require.NoError(t, err)

t.Logf("Sandbox state should be NOTREADY")
Expand Down

0 comments on commit 47fc645

Please sign in to comment.