From 35669647b1dfeb56fd8f0884b85113414110dc84 Mon Sep 17 00:00:00 2001 From: Mohammed Affan <72978371+Affan-7@users.noreply.github.com> Date: Sat, 22 Jul 2023 03:25:39 +0000 Subject: [PATCH 1/2] Fixed scientific convention issue in image size Signed-off-by: Mohammed Affan <72978371+Affan-7@users.noreply.github.com> --- cli/command/formatter/image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/command/formatter/image.go b/cli/command/formatter/image.go index 503c1011a222..85ffd2dcaf38 100644 --- a/cli/command/formatter/image.go +++ b/cli/command/formatter/image.go @@ -250,7 +250,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 { From 1d981e2ca472a8e4ebe328e7a9824989b896bef4 Mon Sep 17 00:00:00 2001 From: Mohammed Affan <72978371+Affan-7@users.noreply.github.com> Date: Sat, 22 Jul 2023 16:26:17 +0000 Subject: [PATCH 2/2] Added a regression test for image size Signed-off-by: Mohammed Affan <72978371+Affan-7@users.noreply.github.com> --- cli/command/formatter/image_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/command/formatter/image_test.go b/cli/command/formatter/image_test.go index ef1e62cb2aff..a7cadc477b23 100644 --- a/cli/command/formatter/image_test.go +++ b/cli/command/formatter/image_test.go @@ -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: types.ImageSummary{Created: unix}, trunc: true}, expValue: time.Unix(unix, 0).String(), call: ctx.CreatedAt,