From 770fa2122aacc64645da94782f0d8e16aaffa797 Mon Sep 17 00:00:00 2001 From: prathapcv Date: Thu, 30 Jul 2026 22:27:12 -0700 Subject: [PATCH 1/2] containerztest: remove container during cleanup after stop --- internal/containerztest/containerztest.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/containerztest/containerztest.go b/internal/containerztest/containerztest.go index d1e83bdabe9..6dd97bd9fab 100644 --- a/internal/containerztest/containerztest.go +++ b/internal/containerztest/containerztest.go @@ -251,6 +251,18 @@ func Stop(ctx context.Context, t *testing.T, cli *client.Client, instNameToStop } else { t.Logf("Container %s stopped successfully.", instNameToStop) } + + t.Logf("Attempting to remove container %s", instNameToStop) + if err := cli.RemoveContainer(ctx, instNameToStop, true); err != nil { + s, _ := status.FromError(err) + if s.Code() == codes.NotFound { + t.Logf("RemoveContainer: Container %s not found (may have already been removed): %v", instNameToStop, err) + } else { + t.Logf("RemoveContainer for %s encountered an issue: %v", instNameToStop, err) + } + } else { + t.Logf("Container %s removed successfully.", instNameToStop) + } } // WaitForRunning polls until a container instance is in the RUNNING state. From 69c3d0bea36a493c2a97e7989bdeb15dc9d69f6a Mon Sep 17 00:00:00 2001 From: prathapcv Date: Thu, 30 Jul 2026 23:15:58 -0700 Subject: [PATCH 2/2] containerztest: use status.Code for NotFound checks in Stop cleanup --- internal/containerztest/containerztest.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/containerztest/containerztest.go b/internal/containerztest/containerztest.go index 6dd97bd9fab..2e2832776b8 100644 --- a/internal/containerztest/containerztest.go +++ b/internal/containerztest/containerztest.go @@ -242,8 +242,7 @@ func Stop(ctx context.Context, t *testing.T, cli *client.Client, instNameToStop t.Helper() t.Logf("Attempting to stop container %s", instNameToStop) if err := cli.StopContainer(ctx, instNameToStop, true); err != nil { - s, _ := status.FromError(err) - if s.Code() == codes.NotFound { + if status.Code(err) == codes.NotFound { t.Logf("StopContainer: Container %s not found (may have already been stopped and removed): %v", instNameToStop, err) } else { t.Logf("StopContainer for %s encountered an issue: %v", instNameToStop, err) @@ -254,8 +253,7 @@ func Stop(ctx context.Context, t *testing.T, cli *client.Client, instNameToStop t.Logf("Attempting to remove container %s", instNameToStop) if err := cli.RemoveContainer(ctx, instNameToStop, true); err != nil { - s, _ := status.FromError(err) - if s.Code() == codes.NotFound { + if status.Code(err) == codes.NotFound { t.Logf("RemoveContainer: Container %s not found (may have already been removed): %v", instNameToStop, err) } else { t.Logf("RemoveContainer for %s encountered an issue: %v", instNameToStop, err)