From a9cbddd65d3eb1c5caa47c9fbc2c34ecce7c7d26 Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Thu, 2 Mar 2023 21:57:43 +0800 Subject: [PATCH] *: fix typo and skip exec-io-drain-testcase in win Signed-off-by: Wei Fu --- integration/container_exec_test.go | 6 ++++++ pkg/cri/sbserver/container_execsync.go | 4 ++-- pkg/cri/server/container_execsync.go | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/integration/container_exec_test.go b/integration/container_exec_test.go index 553faec6e..1fcd1d765 100644 --- a/integration/container_exec_test.go +++ b/integration/container_exec_test.go @@ -17,6 +17,7 @@ package integration import ( + "runtime" "testing" "time" @@ -27,6 +28,11 @@ import ( ) func TestContainerDrainExecIOAfterExit(t *testing.T) { + // FIXME(fuweid): support it for windows container. + if runtime.GOOS == "windows" { + t.Skip("it seems that windows platform doesn't support detached process. skip it") + } + t.Log("Create a sandbox") sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "container-exec-drain-io-after-exit") diff --git a/pkg/cri/sbserver/container_execsync.go b/pkg/cri/sbserver/container_execsync.go index 0016155ed..90ff79d7f 100644 --- a/pkg/cri/sbserver/container_execsync.go +++ b/pkg/cri/sbserver/container_execsync.go @@ -284,7 +284,7 @@ func drainExecIO(ctx context.Context, execProcess containerd.Process, attachDone return nil } - log.G(ctx).Debugf("Exec process %q exits but the io is still hold by other processes. Trying to delete exec process to release io", execProcess.ID()) + log.G(ctx).Debugf("Exec process %q exits but the io is still held by other processes. Trying to delete exec process to release io", execProcess.ID()) _, err := execProcess.Delete(ctx, containerd.WithProcessKill) if err != nil { if !errdefs.IsNotFound(err) { @@ -292,5 +292,5 @@ func drainExecIO(ctx context.Context, execProcess containerd.Process, attachDone execProcess.ID(), err) } } - return fmt.Errorf("failed to drain exec process %q io because io is still hold by other processes", execProcess.ID()) + return fmt.Errorf("failed to drain exec process %q io because io is still held by other processes", execProcess.ID()) } diff --git a/pkg/cri/server/container_execsync.go b/pkg/cri/server/container_execsync.go index 158ee9f23..c9d10cc6b 100644 --- a/pkg/cri/server/container_execsync.go +++ b/pkg/cri/server/container_execsync.go @@ -284,7 +284,7 @@ func drainExecIO(ctx context.Context, execProcess containerd.Process, attachDone return nil } - log.G(ctx).Debugf("Exec process %q exits but the io is still hold by other processes. Trying to delete exec process to release io", execProcess.ID()) + log.G(ctx).Debugf("Exec process %q exits but the io is still held by other processes. Trying to delete exec process to release io", execProcess.ID()) _, err := execProcess.Delete(ctx, containerd.WithProcessKill) if err != nil { if !errdefs.IsNotFound(err) { @@ -292,5 +292,5 @@ func drainExecIO(ctx context.Context, execProcess containerd.Process, attachDone execProcess.ID(), err) } } - return fmt.Errorf("failed to drain exec process %q io because io is still hold by other processes", execProcess.ID()) + return fmt.Errorf("failed to drain exec process %q io because io is still held by other processes", execProcess.ID()) }