This commit is contained in:
Nate 2024-11-06 13:41:57 -08:00 committed by GitHub
commit 266a0027ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -248,7 +248,7 @@ func (c *imageContext) CreatedAt() string {
}
func (c *imageContext) Size() string {
return units.HumanSizeWithPrecision(float64(c.i.Size), 3)
return units.HumanSize(float64(c.i.Size))
}
func (c *imageContext) Containers() string {

View File

@ -40,6 +40,11 @@ func TestImageContext(t *testing.T) {
expValue: "10B",
call: ctx.Size,
},
{
imageCtx: imageContext{i: types.ImageSummary{Size: 999900000}, trunc: true},
expValue: "999.9MB",
call: ctx.Size,
},
{
imageCtx: imageContext{i: image.Summary{Created: unix}, trunc: true},
expValue: time.Unix(unix, 0).String(), call: ctx.CreatedAt,