mirror of
https://github.com/containers/podman.git
synced 2025-06-20 00:51:16 +08:00
Merge pull request #9122 from Luap99/fix-9120
Fix podman history --no-trunc for the CREATED BY field
This commit is contained in:
@ -162,7 +162,7 @@ func (h historyReporter) Size() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h historyReporter) CreatedBy() 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[:45-3] + "..."
|
||||||
}
|
}
|
||||||
return h.ImageHistoryLayer.CreatedBy
|
return h.ImageHistoryLayer.CreatedBy
|
||||||
|
@ -65,6 +65,23 @@ var _ = Describe("Podman history", func() {
|
|||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 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() {
|
It("podman history with json flag", func() {
|
||||||
|
Reference in New Issue
Block a user