summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-01-27 10:42:22 +0100
committerPaul Holzinger <paul.holzinger@web.de>2021-01-27 10:44:54 +0100
commitf79d68eeae7dbc2c1a6dc2d52a24eeed23ed36ab (patch)
tree4c988f39ee07048102335af1c337d7aa9eb14ed7
parent79565d1af18f07754e067b7203f42122d8fc03a9 (diff)
downloadpodman-f79d68eeae7dbc2c1a6dc2d52a24eeed23ed36ab.tar.gz
podman-f79d68eeae7dbc2c1a6dc2d52a24eeed23ed36ab.tar.bz2
podman-f79d68eeae7dbc2c1a6dc2d52a24eeed23ed36ab.zip
Fix podman history --no-trunc for the CREATED BY field
Fixes #9120 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
-rw-r--r--cmd/podman/images/history.go2
-rw-r--r--test/e2e/history_test.go17
2 files changed, 18 insertions, 1 deletions
diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go
index 964c7a975..af40dd73a 100644
--- a/cmd/podman/images/history.go
+++ b/cmd/podman/images/history.go
@@ -162,7 +162,7 @@ func (h historyReporter) Size() string {
}
func (h historyReporter) CreatedBy() string {
- if len(h.ImageHistoryLayer.CreatedBy) > 45 {
+ if !opts.noTrunc && len(h.ImageHistoryLayer.CreatedBy) > 45 {
return h.ImageHistoryLayer.CreatedBy[:45-3] + "..."
}
return h.ImageHistoryLayer.CreatedBy
diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go
index fea3f4d43..1c57c60de 100644
--- a/test/e2e/history_test.go
+++ b/test/e2e/history_test.go
@@ -65,6 +65,23 @@ var _ = Describe("Podman history", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
+
+ session = podmanTest.Podman([]string{"history", "--no-trunc", "--format", "{{.ID}}", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ lines := session.OutputToStringArray()
+ Expect(len(lines)).To(BeNumerically(">", 0))
+ // the image id must be 64 chars long
+ Expect(len(lines[0])).To(BeNumerically("==", 64))
+
+ session = podmanTest.Podman([]string{"history", "--no-trunc", "--format", "{{.CreatedBy}}", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ lines = session.OutputToStringArray()
+ Expect(len(lines)).To(BeNumerically(">", 0))
+ Expect(session.OutputToString()).ToNot(ContainSubstring("..."))
+ // the second line in the alpine history contains a command longer than 45 chars
+ Expect(len(lines[1])).To(BeNumerically(">", 45))
})
It("podman history with json flag", func() {