From 5f999b6bcda79538cb1033503acd4c25615bd43b Mon Sep 17 00:00:00 2001 From: baude Date: Thu, 11 Feb 2021 09:23:49 -0600 Subject: container ps json format miscue when printing out json format, we mistakenly changed the Created field output to be a time.time in a different commit. This allows for override of the Created field to be a unix ts as type int64. Fixes: #9315 Signed-off-by: baude --- test/e2e/ps_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/e2e/ps_test.go') diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index db3f7a36b..225bd538e 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -5,6 +5,7 @@ import ( "os" "regexp" "sort" + "strconv" "strings" . "github.com/containers/podman/v2/test/utils" @@ -210,6 +211,22 @@ var _ = Describe("Podman ps", func() { Expect(result.IsJSONOutputValid()).To(BeTrue()) }) + It("podman ps json format Created field is int64", func() { + session := podmanTest.RunTopContainer("test1") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"ps", "--format", "json"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + + // Make sure Created field is an int64 + created, err := result.jq(".[0].Created") + Expect(err).To(BeNil()) + _, err = strconv.ParseInt(created, 10, 64) + Expect(err).To(BeNil()) + }) + It("podman ps print a human-readable `Status` with json format", func() { _, ec, _ := podmanTest.RunLsContainer("test1") Expect(ec).To(Equal(0)) -- cgit v1.2.3-54-g00ecf