mirror of
https://github.com/containers/podman.git
synced 2026-07-11 07:45:16 -04:00
Fix duplicated command in inspect Args when container has single-element command
Fixes: https://github.com/podman-container-tools/podman/issues/29155 Signed-off-by: Jan Rodák <hony.com@seznam.cz>
This commit is contained in:
@@ -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:]
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user