diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go index 3106488335..3395167131 100644 --- a/libpod/container_inspect.go +++ b/libpod/container_inspect.go @@ -77,8 +77,6 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver var path string if len(args) > 0 { path = args[0] - } - if len(args) > 1 { args = args[1:] } diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index 9f74b16735..a517a5c74e 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -500,7 +500,7 @@ var _ = Describe("Podman pod create", func() { check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID}) check2.WaitWithDefaultTimeout() Expect(check2).Should(ExitCleanly()) - Expect(check2.OutputToString()).To(Equal("/pause1:[/pause1]")) + Expect(check2.OutputToString()).To(Equal("/pause1:[]")) }) It("podman create pod with --infra-image", func() { @@ -527,7 +527,7 @@ entrypoint ["/fromimage"] check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID}) check2.WaitWithDefaultTimeout() Expect(check2).Should(ExitCleanly()) - Expect(check2.OutputToString()).To(Equal("/fromimage:[/fromimage]")) + Expect(check2.OutputToString()).To(Equal("/fromimage:[]")) }) It("podman create pod with --infra-command --infra-image", func() { @@ -554,7 +554,7 @@ entrypoint ["/fromimage"] check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID}) check2.WaitWithDefaultTimeout() Expect(check2).Should(ExitCleanly()) - Expect(check2.OutputToString()).To(Equal("/fromcommand:[/fromcommand]")) + Expect(check2.OutputToString()).To(Equal("/fromcommand:[]")) }) It("podman pod status test", func() { diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 36cd5a5e95..0616134bba 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -1961,4 +1961,23 @@ spec: run_podman rmi $image } +# bats test_tags=ci:parallel +@test "podman inspect - Args does not duplicate Path for single command" { + cname=c_$(safename) + + run_podman run --name $cname -d $IMAGE top -b + run_podman inspect $cname --format '{{.Path}}' + is "$output" "top" ".Path is the command" + run_podman inspect $cname --format '{{join .Args " "}}' + is "$output" "-b" ".Args holds only the arguments after the command" + run_podman rm -f $cname + + run_podman run --name $cname -d $IMAGE top + run_podman inspect $cname --format '{{.Path}}' + is "$output" "top" ".Path is the command" + run_podman inspect $cname --format '{{len .Args}}' + is "$output" "0" ".Args should be empty when command has no arguments" + run_podman rm -f $cname +} + # vim: filetype=sh