Skip to content

Commit

Permalink
Merge pull request #7575 from rhatdan/runlabel
Browse files Browse the repository at this point in the history
Fix podman container runlabel --display
  • Loading branch information
openshift-merge-robot authored Sep 9, 2020
2 parents 68dace0 + 1d7d218 commit 08b6020
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/domain/infra/abi/containers_runlabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func (ic *ContainerEngine) ContainerRunlabel(ctx context.Context, label string,
return err
}

if options.Display {
fmt.Printf("command: %s\n", strings.Join(append([]string{os.Args[0]}, cmd[1:]...), " "))
return nil
}

stdErr := os.Stderr
stdOut := os.Stdout
stdIn := os.Stdin
Expand Down
15 changes: 15 additions & 0 deletions test/e2e/runlabel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ var _ = Describe("podman container runlabel", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})

It("podman container runlabel --display", func() {
SkipIfRemote()
image := "podman-runlabel-test:ls"
podmanTest.BuildImage(LsDockerfile, image, "false")

result := podmanTest.Podman([]string{"container", "runlabel", "--display", "RUN", image})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(result.OutputToString()).To(ContainSubstring(podmanTest.PodmanBinary + " -la"))

result = podmanTest.Podman([]string{"rmi", image})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
It("podman container runlabel bogus label should result in non-zero exit code", func() {
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", ALPINE})
result.WaitWithDefaultTimeout()
Expand Down

0 comments on commit 08b6020

Please sign in to comment.