From f04ada37b45c0b4b780d864289d1d7a020aed281 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 15 Jul 2025 16:49:31 +0200 Subject: [PATCH] [v5.4-rhel] podman inspect: fix error difference between local... and remote There is no reason for local and rmeote to use a different error that just differs in quoting. Make them consitent to simplify the tests. Signed-off-by: Paul Holzinger Signed-off-by: tomsweeneyredhat --- pkg/domain/infra/abi/containers.go | 4 ++-- test/e2e/inspect_test.go | 12 ++---------- test/system/252-quadlet.bats | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index c08f0ab3fb..fc01f6114c 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -538,7 +538,7 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st // ErrNoSuchCtr is non-fatal, other errors will be // treated as fatal. if errors.Is(err, define.ErrNoSuchCtr) { - errs = append(errs, fmt.Errorf("no such container %s", name)) + errs = append(errs, fmt.Errorf("no such container %q", name)) continue } return nil, nil, err @@ -549,7 +549,7 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st // ErrNoSuchCtr is non-fatal, other errors will be // treated as fatal. if errors.Is(err, define.ErrNoSuchCtr) { - errs = append(errs, fmt.Errorf("no such container %s", name)) + errs = append(errs, fmt.Errorf("no such container %q", name)) continue } return nil, nil, err diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go index be7809bd32..61f3f50f9d 100644 --- a/test/e2e/inspect_test.go +++ b/test/e2e/inspect_test.go @@ -188,11 +188,7 @@ var _ = Describe("Podman inspect", func() { ctrInspect := podmanTest.Podman([]string{"container", "inspect", ALPINE}) ctrInspect.WaitWithDefaultTimeout() - if IsRemote() { - Expect(ctrInspect).To(ExitWithError(125, fmt.Sprintf("no such container %q", ALPINE))) - } else { - Expect(ctrInspect).To(ExitWithError(125, fmt.Sprintf("no such container %s", ALPINE))) - } + Expect(ctrInspect).To(ExitWithError(125, fmt.Sprintf("no such container %q", ALPINE))) imageInspect := podmanTest.Podman([]string{"image", "inspect", ALPINE}) imageInspect.WaitWithDefaultTimeout() @@ -399,11 +395,7 @@ var _ = Describe("Podman inspect", func() { inspect := podmanTest.Podman([]string{"inspect", "--type", "container", podName}) inspect.WaitWithDefaultTimeout() - if IsRemote() { - Expect(inspect).To(ExitWithError(125, fmt.Sprintf("no such container %q", podName))) - } else { - Expect(inspect).To(ExitWithError(125, fmt.Sprintf("no such container %s", podName))) - } + Expect(inspect).To(ExitWithError(125, fmt.Sprintf("no such container %q", podName))) }) It("podman inspect --type network on a container should fail", func() { diff --git a/test/system/252-quadlet.bats b/test/system/252-quadlet.bats index 264518b269..34e718ec0f 100644 --- a/test/system/252-quadlet.bats +++ b/test/system/252-quadlet.bats @@ -1024,7 +1024,7 @@ EOF is "$output" "$exit_code_prop" \ "$basename: service container has the expected policy set in its annotations" else - assert "$output" =~ "no such container $service_container" \ + assert "$output" =~ "no such container \"$service_container\"" \ "$basename: unexpected error from podman container inspect" fi