Merge pull request #7675 from zhangguanzhang/set-process-path-and-arg-with-infra-command

fix the .Path and .Args when use the infra-command
This commit is contained in:
OpenShift Merge Robot
2020-09-18 06:15:52 -04:00
committed by GitHub
2 changed files with 28 additions and 0 deletions

View File

@ -50,7 +50,11 @@ func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, rawIm
entryPoint = config.Entrypoint
entryCmd = config.Entrypoint
}
} else { // so use the InfraCommand
entrypointSet = true
entryCmd = entryPoint
}
if len(config.Cmd) > 0 {
// We can't use the default pause command, since we're
// sourcing from the image. If we didn't already set an

View File

@ -345,6 +345,12 @@ var _ = Describe("Podman pod create", func() {
check1.WaitWithDefaultTimeout()
Expect(check1.ExitCode()).To(Equal(0))
Expect(check1.OutputToString()).To(Equal("/pause"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
Expect(check2.ExitCode()).To(Equal(0))
Expect(check2.OutputToString()).To(Equal("/pause:[/pause]"))
})
It("podman create pod with --infra-command", func() {
@ -362,6 +368,12 @@ var _ = Describe("Podman pod create", func() {
check1.WaitWithDefaultTimeout()
Expect(check1.ExitCode()).To(Equal(0))
Expect(check1.OutputToString()).To(Equal("/pause1"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
Expect(check2.ExitCode()).To(Equal(0))
Expect(check2.OutputToString()).To(Equal("/pause1:[/pause1]"))
})
It("podman create pod with --infra-image", func() {
@ -383,6 +395,12 @@ entrypoint ["/fromimage"]
check1.WaitWithDefaultTimeout()
Expect(check1.ExitCode()).To(Equal(0))
Expect(check1.OutputToString()).To(Equal("/fromimage"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
Expect(check2.ExitCode()).To(Equal(0))
Expect(check2.OutputToString()).To(Equal("/fromimage:[/fromimage]"))
})
It("podman create pod with --infra-command --infra-image", func() {
@ -404,5 +422,11 @@ entrypoint ["/fromimage"]
check1.WaitWithDefaultTimeout()
Expect(check1.ExitCode()).To(Equal(0))
Expect(check1.OutputToString()).To(Equal("/fromcommand"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
Expect(check2.ExitCode()).To(Equal(0))
Expect(check2.OutputToString()).To(Equal("/fromcommand:[/fromcommand]"))
})
})