Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Illustrate #2176 whitelist problem with test
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco committed Nov 19, 2019
1 parent 80d1c01 commit dd2f2c4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/image/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ func TestImageInfoCreatedAtZero(t *testing.T) {
func TestImage_OrderByCreationDate(t *testing.T) {
time0 := testTime.Add(time.Second)
time2 := testTime.Add(-time.Second)
ignoredTime := testTime.Add(+time.Minute)
ignoredTime2 := testTime.Add(+time.Hour)
imA := mustMakeInfo("my/Image:2", testTime)
imB := mustMakeInfo("my/Image:0", time0)
imC := mustMakeInfo("my/Image:3", time2)
imD := mustMakeInfo("my/Image:4", time.Time{}) // test nil
imE := mustMakeInfo("my/Image:1", testTime) // test equal
imF := mustMakeInfo("my/Image:5", time.Time{}) // test nil equal
imB := mustMakeInfo("my/Image:0", time0).setLabels(Labels{Created: ignoredTime2}) // label time should be ignored
imC := mustMakeInfo("my/Image:3", time2).setLabels(Labels{BuildDate: ignoredTime}) // label time should be ignored
imD := mustMakeInfo("my/Image:4", time.Time{}) // test nil
imE := mustMakeInfo("my/Image:1", testTime).setLabels(Labels{Created: testTime}) // test equal
imF := mustMakeInfo("my/Image:5", time.Time{}) // test nil equal
imgs := []Info{imA, imB, imC, imD, imE, imF}
Sort(imgs, NewerByCreated)
checkSorted(t, imgs)
Expand Down

0 comments on commit dd2f2c4

Please sign in to comment.