diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-31 03:24:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-31 03:24:35 -0400 |
commit | 0e009d5f80a8aa3192035a8704b3fc3edcb729c6 (patch) | |
tree | 1a8eef2e62b98b8dd32a0ca0e843d02e1e4642fe | |
parent | 1b784b4c3509e94b9e5b2f6bb432042978bd2fb6 (diff) | |
parent | 8e6a6197db6496b9ef98399be49dfda8fb14811a (diff) | |
download | podman-0e009d5f80a8aa3192035a8704b3fc3edcb729c6.tar.gz podman-0e009d5f80a8aa3192035a8704b3fc3edcb729c6.tar.bz2 podman-0e009d5f80a8aa3192035a8704b3fc3edcb729c6.zip |
Merge pull request #7159 from ashley-cui/runningfor
add {{.RunningFor}} placeholder in ps --format
-rw-r--r-- | cmd/podman/containers/ps.go | 4 | ||||
-rw-r--r-- | test/e2e/ps_test.go | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index 34fa4fab5..64271031d 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -307,6 +307,10 @@ func (l psReporter) Status() string { return l.State() } +func (l psReporter) RunningFor() string { + return l.CreatedHuman() +} + // Command returns the container command in string format func (l psReporter) Command() string { command := strings.Join(l.ListContainer.Command, " ") diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 281968fcd..f10ef5c99 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -476,5 +476,13 @@ var _ = Describe("Podman ps", func() { session.WaitWithDefaultTimeout() Expect(session.OutputToString()).To(ContainSubstring("echo very long cr...")) }) + It("podman ps --format {{RunningFor}}", func() { + _, ec, _ := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + result := podmanTest.Podman([]string{"ps", "-a", "--format", "{{.RunningFor}}"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + Expect(result.OutputToString()).To(ContainSubstring("ago")) + }) }) |