@@ -29,6 +29,7 @@ import (
29
29
"github.com/containerd/nerdctl/mod/tigron/require"
30
30
"github.com/containerd/nerdctl/mod/tigron/test"
31
31
32
+ "github.com/containerd/nerdctl/v2/pkg/formatter"
32
33
"github.com/containerd/nerdctl/v2/pkg/testutil"
33
34
"github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest"
34
35
)
@@ -93,11 +94,6 @@ func TestImageHistory(t *testing.T) {
93
94
history , err := decode (stdout )
94
95
assert .NilError (t , err , info )
95
96
assert .Equal (t , len (history ), 2 , info )
96
- assert .Equal (t , history [0 ].Size , "0B" , info )
97
- // FIXME: how is this going to age?
98
- assert .Equal (t , history [0 ].CreatedSince , "4 years ago" , info )
99
- assert .Equal (t , history [0 ].Snapshot , "<missing>" , info )
100
- assert .Equal (t , history [0 ].Comment , "" , info )
101
97
102
98
localTimeL1 , _ := time .Parse (time .RFC3339 , "2021-03-31T10:21:23-07:00" )
103
99
localTimeL2 , _ := time .Parse (time .RFC3339 , "2021-03-31T10:21:21-07:00" )
@@ -108,8 +104,13 @@ func TestImageHistory(t *testing.T) {
108
104
assert .Equal (t , compTime2 .UTC ().String (), localTimeL2 .UTC ().String (), info )
109
105
assert .Equal (t , history [1 ].CreatedBy , "/bin/sh -c #(nop) ADD file:3b16ffee2b26d8af5…" , info )
110
106
107
+ assert .Equal (t , history [0 ].Size , "0B" , info )
108
+ assert .Equal (t , history [0 ].CreatedSince , formatter .TimeSinceInHuman (compTime1 ), info )
109
+ assert .Equal (t , history [0 ].Snapshot , "<missing>" , info )
110
+ assert .Equal (t , history [0 ].Comment , "" , info )
111
+
111
112
assert .Equal (t , history [1 ].Size , "5.947MB" , info )
112
- assert .Equal (t , history [1 ].CreatedSince , "4 years ago" , info )
113
+ assert .Equal (t , history [1 ].CreatedSince , formatter . TimeSinceInHuman ( compTime2 ) , info )
113
114
assert .Equal (t , history [1 ].Snapshot , "sha256:56bf55b8eed1f0b4794a30386e4d1d3da949c…" , info )
114
115
assert .Equal (t , history [1 ].Comment , "" , info )
115
116
}),
0 commit comments