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 <aaron.lehmann@docker.com>
| ... | ... |
@@ -123,6 +123,19 @@ func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
|
| 123 | 123 |
c.Assert(latestLine, checker.Not(checker.Equals), "", check.Commentf("no entry for busybox:latest found after pulling all tags"))
|
| 124 | 124 |
splitLatest := strings.Fields(latestLine) |
| 125 | 125 |
splitCurrent := strings.Fields(splitOutImageCmd[1]) |
| 126 |
+ |
|
| 127 |
+ // Clear relative creation times, since these can easily change between |
|
| 128 |
+ // two invocations of "docker images". Without this, the test can fail |
|
| 129 |
+ // like this: |
|
| 130 |
+ // ... obtained []string = []string{"busybox", "latest", "d9551b4026f0", "27", "minutes", "ago", "1.113", "MB"}
|
|
| 131 |
+ // ... expected []string = []string{"busybox", "latest", "d9551b4026f0", "26", "minutes", "ago", "1.113", "MB"}
|
|
| 132 |
+ splitLatest[3] = "" |
|
| 133 |
+ splitLatest[4] = "" |
|
| 134 |
+ splitLatest[5] = "" |
|
| 135 |
+ splitCurrent[3] = "" |
|
| 136 |
+ splitCurrent[4] = "" |
|
| 137 |
+ splitCurrent[5] = "" |
|
| 138 |
+ |
|
| 126 | 139 |
c.Assert(splitLatest, checker.DeepEquals, splitCurrent, check.Commentf("busybox:latest was changed after pulling all tags"))
|
| 127 | 140 |
} |
| 128 | 141 |
|