summaryrefslogtreecommitdiff
path: root/integration-cli/docker_cli_images_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integration-cli/docker_cli_images_test.go')
-rw-r--r--integration-cli/docker_cli_images_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/integration-cli/docker_cli_images_test.go b/integration-cli/docker_cli_images_test.go
index b27bc870fe..2cf2bbfcf5 100644
--- a/integration-cli/docker_cli_images_test.go
+++ b/integration-cli/docker_cli_images_test.go
@@ -5,6 +5,7 @@ import (
"os/exec"
"strings"
"testing"
+ "time"
)
func TestImagesEnsureImageIsListed(t *testing.T) {
@@ -56,3 +57,44 @@ func TestCLIImageTagRemove(t *testing.T) {
}
logDone("tag,rmi- tagging the same images multiple times then removing tags")
}
+
+func TestImagesOrderedByCreationDate(t *testing.T) {
+ defer deleteImages("order:test_a")
+ defer deleteImages("order:test_c")
+ defer deleteImages("order:test_b")
+ id1, err := buildImage("order:test_a",
+ `FROM scratch
+ MAINTAINER dockerio1`, true)
+ if err != nil {
+ t.Fatal(err)
+ }
+ time.Sleep(time.Second)
+ id2, err := buildImage("order:test_c",
+ `FROM scratch
+ MAINTAINER dockerio2`, true)
+ if err != nil {
+ t.Fatal(err)
+ }
+ time.Sleep(time.Second)
+ id3, err := buildImage("order:test_b",
+ `FROM scratch
+ MAINTAINER dockerio3`, true)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "images", "-q", "--no-trunc"))
+ errorOut(err, t, fmt.Sprintf("listing images failed with errors: %v", err))
+ imgs := strings.Split(out, "\n")
+ if imgs[0] != id3 {
+ t.Fatalf("First image must be %s, got %s", id3, imgs[0])
+ }
+ if imgs[1] != id2 {
+ t.Fatalf("Second image must be %s, got %s", id2, imgs[1])
+ }
+ if imgs[2] != id1 {
+ t.Fatalf("Third image must be %s, got %s", id1, imgs[2])
+ }
+
+ logDone("images - ordering by creation date")
+}