mirror of https://github.com/docker/cli.git
cli/formatter: reformat TestImageContext test cases
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
d642de78f3
commit
0c2fe385bf
|
@ -25,63 +25,69 @@ func TestImageContext(t *testing.T) {
|
||||||
expValue string
|
expValue string
|
||||||
call func() string
|
call func() string
|
||||||
}{
|
}{
|
||||||
{imageContext{
|
{
|
||||||
i: types.ImageSummary{ID: imageID},
|
imageCtx: imageContext{i: types.ImageSummary{ID: imageID}, trunc: true},
|
||||||
trunc: true,
|
expValue: stringid.TruncateID(imageID),
|
||||||
}, stringid.TruncateID(imageID), ctx.ID},
|
call: ctx.ID,
|
||||||
{imageContext{
|
},
|
||||||
i: types.ImageSummary{ID: imageID},
|
{
|
||||||
trunc: false,
|
imageCtx: imageContext{i: types.ImageSummary{ID: imageID}, trunc: false},
|
||||||
}, imageID, ctx.ID},
|
expValue: imageID,
|
||||||
{imageContext{
|
call: ctx.ID,
|
||||||
i: types.ImageSummary{Size: 10, VirtualSize: 10},
|
},
|
||||||
trunc: true,
|
{
|
||||||
}, "10B", ctx.Size},
|
imageCtx: imageContext{i: types.ImageSummary{Size: 10, VirtualSize: 10}, trunc: true},
|
||||||
{imageContext{
|
expValue: "10B",
|
||||||
i: types.ImageSummary{Created: unix},
|
call: ctx.Size,
|
||||||
trunc: true,
|
},
|
||||||
}, time.Unix(unix, 0).String(), ctx.CreatedAt},
|
{
|
||||||
|
imageCtx: imageContext{i: types.ImageSummary{Created: unix}, trunc: true},
|
||||||
|
expValue: time.Unix(unix, 0).String(), call: ctx.CreatedAt,
|
||||||
|
},
|
||||||
// FIXME
|
// FIXME
|
||||||
// {imageContext{
|
// {imageContext{
|
||||||
// i: types.ImageSummary{Created: unix},
|
// i: types.ImageSummary{Created: unix},
|
||||||
// trunc: true,
|
// trunc: true,
|
||||||
// }, units.HumanDuration(time.Unix(unix, 0)), createdSinceHeader, ctx.CreatedSince},
|
// }, units.HumanDuration(time.Unix(unix, 0)), createdSinceHeader, ctx.CreatedSince},
|
||||||
{imageContext{
|
|
||||||
i: types.ImageSummary{},
|
|
||||||
repo: "busybox",
|
|
||||||
}, "busybox", ctx.Repository},
|
|
||||||
{imageContext{
|
|
||||||
i: types.ImageSummary{},
|
|
||||||
tag: "latest",
|
|
||||||
}, "latest", ctx.Tag},
|
|
||||||
{imageContext{
|
|
||||||
i: types.ImageSummary{},
|
|
||||||
digest: "sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a",
|
|
||||||
}, "sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a", ctx.Digest},
|
|
||||||
{
|
{
|
||||||
imageContext{
|
imageCtx: imageContext{i: types.ImageSummary{}, repo: "busybox"},
|
||||||
i: types.ImageSummary{Containers: 10},
|
expValue: "busybox",
|
||||||
}, "10", ctx.Containers,
|
call: ctx.Repository,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageContext{
|
imageCtx: imageContext{i: types.ImageSummary{}, tag: "latest"},
|
||||||
i: types.ImageSummary{VirtualSize: 10000},
|
expValue: "latest",
|
||||||
}, "10kB", ctx.VirtualSize,
|
call: ctx.Tag,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageContext{
|
imageCtx: imageContext{i: types.ImageSummary{}, digest: "sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a"},
|
||||||
i: types.ImageSummary{SharedSize: 10000},
|
expValue: "sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a",
|
||||||
}, "10kB", ctx.SharedSize,
|
call: ctx.Digest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageContext{
|
imageCtx: imageContext{i: types.ImageSummary{Containers: 10}},
|
||||||
i: types.ImageSummary{SharedSize: 5000, VirtualSize: 20000},
|
expValue: "10",
|
||||||
}, "15kB", ctx.UniqueSize,
|
call: ctx.Containers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageContext{
|
imageCtx: imageContext{i: types.ImageSummary{VirtualSize: 10000}},
|
||||||
i: types.ImageSummary{Created: zeroTime},
|
expValue: "10kB",
|
||||||
}, "", ctx.CreatedSince,
|
call: ctx.VirtualSize,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
imageCtx: imageContext{i: types.ImageSummary{SharedSize: 10000}},
|
||||||
|
expValue: "10kB",
|
||||||
|
call: ctx.SharedSize,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
imageCtx: imageContext{i: types.ImageSummary{SharedSize: 5000, VirtualSize: 20000}},
|
||||||
|
expValue: "15kB",
|
||||||
|
call: ctx.UniqueSize,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
imageCtx: imageContext{i: types.ImageSummary{Created: zeroTime}},
|
||||||
|
expValue: "",
|
||||||
|
call: ctx.CreatedSince,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue