From d17669999fff55219f5ed236f00fdf8a08d09304 Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Tue, 8 Dec 2015 11:23:04 -0800 Subject: [PATCH] Fix flaky test TestPullAllTagsFromCentralRegistry This test was directly comparing lines of output from "docker images". Sometimes, when busybox had been pushed to the hub recently, the relative creation times would differ like this: ... obtained []string = []string{"busybox", "latest", "d9551b4026f0", "27", "minutes", "ago", "1.113", "MB"} ... expected []string = []string{"busybox", "latest", "d9551b4026f0", "26", "minutes", "ago", "1.113", "MB"} Fixing by removing the time-since-creation fields from the comparison. Signed-off-by: Aaron Lehmann --- integration-cli/docker_cli_pull_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/integration-cli/docker_cli_pull_test.go b/integration-cli/docker_cli_pull_test.go index 4f5f7281fb..411acec539 100644 --- a/integration-cli/docker_cli_pull_test.go +++ b/integration-cli/docker_cli_pull_test.go @@ -123,6 +123,19 @@ func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) { c.Assert(latestLine, checker.Not(checker.Equals), "", check.Commentf("no entry for busybox:latest found after pulling all tags")) splitLatest := strings.Fields(latestLine) splitCurrent := strings.Fields(splitOutImageCmd[1]) + + // Clear relative creation times, since these can easily change between + // two invocations of "docker images". Without this, the test can fail + // like this: + // ... obtained []string = []string{"busybox", "latest", "d9551b4026f0", "27", "minutes", "ago", "1.113", "MB"} + // ... expected []string = []string{"busybox", "latest", "d9551b4026f0", "26", "minutes", "ago", "1.113", "MB"} + splitLatest[3] = "" + splitLatest[4] = "" + splitLatest[5] = "" + splitCurrent[3] = "" + splitCurrent[4] = "" + splitCurrent[5] = "" + c.Assert(splitLatest, checker.DeepEquals, splitCurrent, check.Commentf("busybox:latest was changed after pulling all tags")) }