@@ -20,6 +20,7 @@ import (
20
20
"context"
21
21
"strings"
22
22
"testing"
23
+ "time"
23
24
24
25
"github.com/docker/docker/api/types"
25
26
"github.com/docker/docker/api/types/container"
@@ -44,8 +45,12 @@ func TestImages(t *testing.T) {
44
45
args := filters .NewArgs (projectFilter (strings .ToLower (testProject )))
45
46
listOpts := container.ListOptions {All : true , Filters : args }
46
47
api .EXPECT ().ServerVersion (gomock .Any ()).Return (types.Version {APIVersion : "1.96" }, nil ).AnyTimes ()
47
- image1 := imageInspect ("image1" , "foo:1" , 12345 )
48
- image2 := imageInspect ("image2" , "bar:2" , 67890 )
48
+ timeStr1 := "2025-06-06T06:06:06.000000000Z"
49
+ created1 , _ := time .Parse (time .RFC3339Nano , timeStr1 )
50
+ timeStr2 := "2025-03-03T03:03:03.000000000Z"
51
+ created2 , _ := time .Parse (time .RFC3339Nano , timeStr2 )
52
+ image1 := imageInspect ("image1" , "foo:1" , 12345 , timeStr1 )
53
+ image2 := imageInspect ("image2" , "bar:2" , 67890 , timeStr2 )
49
54
api .EXPECT ().ImageInspect (anyCancellableContext (), "foo:1" ).Return (image1 , nil ).MaxTimes (2 )
50
55
api .EXPECT ().ImageInspect (anyCancellableContext (), "bar:2" ).Return (image2 , nil )
51
56
c1 := containerDetail ("service1" , "123" , "running" , "foo:1" )
@@ -62,32 +67,36 @@ func TestImages(t *testing.T) {
62
67
Repository : "foo" ,
63
68
Tag : "1" ,
64
69
Size : 12345 ,
70
+ Created : created1 ,
65
71
},
66
72
"456" : {
67
73
ID : "image2" ,
68
74
Repository : "bar" ,
69
75
Tag : "2" ,
70
76
Size : 67890 ,
77
+ Created : created2 ,
71
78
},
72
79
"789" : {
73
80
ID : "image1" ,
74
81
Repository : "foo" ,
75
82
Tag : "1" ,
76
83
Size : 12345 ,
84
+ Created : created1 ,
77
85
},
78
86
}
79
87
assert .NilError (t , err )
80
88
assert .DeepEqual (t , images , expected )
81
89
}
82
90
83
- func imageInspect (id string , imageReference string , size int64 ) image.InspectResponse {
91
+ func imageInspect (id string , imageReference string , size int64 , created string ) image.InspectResponse {
84
92
return image.InspectResponse {
85
93
ID : id ,
86
94
RepoTags : []string {
87
95
"someRepo:someTag" ,
88
96
imageReference ,
89
97
},
90
- Size : size ,
98
+ Size : size ,
99
+ Created : created ,
91
100
}
92
101
}
93
102
0 commit comments