diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go index c05d3475bf20..3ccdd72a17b2 100644 --- a/cmd/podman/images/history.go +++ b/cmd/podman/images/history.go @@ -168,3 +168,11 @@ func (h historyReporter) ID() string { } return h.ImageHistoryLayer.ID } + +func (h historyReporter) CreatedAt() string { + return h.ImageHistoryLayer.Created.UTC().String() +} + +func (h historyReporter) CreatedSince() string { + return h.Created() +} diff --git a/test/system/010-images.bats b/test/system/010-images.bats index 257508418592..2989780b671d 100644 --- a/test/system/010-images.bats +++ b/test/system/010-images.bats @@ -312,4 +312,19 @@ Deleted: $pauseID" is "$output" "" } +@test "podman image history" { + run_podman image list --format '{{.CreatedSince}}' $IMAGE + imageSince="$output" + run_podman image list --format '{{.CreatedAt}}' $IMAGE + run cut -f1 -d'.' <<< "$output" + imageAt="$output" + run_podman image history $IMAGE + run_podman image history --format '{{.CreatedSince}}' $IMAGE + is "${lines[0]}" "$imageSince" "History image list should match .CreatedSince" + run_podman image history --format '{{.CreatedAt}}' $IMAGE + line="$lines[0]" + run cut -f1 -d'.' <<< "$line" + assert "${output}" == "$imageAt" "History image list should match .CreatedAt" +} + # vim: filetype=sh