mirror of https://github.com/docker/cli.git
Bump go-units
To include https://github.com/docker/go-units/pull/23 Fixes a unit test that fails because of it. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
6d194cd68d
commit
6ef0b64945
|
@ -54,8 +54,8 @@ func TestContainerPsContext(t *testing.T) {
|
|||
{types.Container{Created: unix}, true, time.Unix(unix, 0).String(), createdAtHeader, ctx.CreatedAt},
|
||||
{types.Container{Ports: []types.Port{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}}}, true, "8080/tcp", portsHeader, ctx.Ports},
|
||||
{types.Container{Status: "RUNNING"}, true, "RUNNING", statusHeader, ctx.Status},
|
||||
{types.Container{SizeRw: 10}, true, "10 B", sizeHeader, ctx.Size},
|
||||
{types.Container{SizeRw: 10, SizeRootFs: 20}, true, "10 B (virtual 20 B)", sizeHeader, ctx.Size},
|
||||
{types.Container{SizeRw: 10}, true, "10B", sizeHeader, ctx.Size},
|
||||
{types.Container{SizeRw: 10, SizeRootFs: 20}, true, "10B (virtual 20B)", sizeHeader, ctx.Size},
|
||||
{types.Container{}, true, "", labelsHeader, ctx.Labels},
|
||||
{types.Container{Labels: map[string]string{"cpu": "6", "storage": "ssd"}}, true, "cpu=6,storage=ssd", labelsHeader, ctx.Labels},
|
||||
{types.Container{Created: unix}, true, "About a minute", runningForHeader, ctx.RunningFor},
|
||||
|
@ -160,8 +160,8 @@ func TestContainerContextWrite(t *testing.T) {
|
|||
{
|
||||
Context{Format: NewContainerFormat("table", false, true)},
|
||||
`CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
|
||||
containerID1 ubuntu "" 24 hours ago foobar_baz 0 B
|
||||
containerID2 ubuntu "" 24 hours ago foobar_bar 0 B
|
||||
containerID1 ubuntu "" 24 hours ago foobar_baz 0B
|
||||
containerID2 ubuntu "" 24 hours ago foobar_bar 0B
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ status:
|
|||
names: foobar_baz
|
||||
labels:
|
||||
ports:
|
||||
size: 0 B
|
||||
size: 0B
|
||||
|
||||
container_id: containerID2
|
||||
image: ubuntu
|
||||
|
@ -230,7 +230,7 @@ status:
|
|||
names: foobar_bar
|
||||
labels:
|
||||
ports:
|
||||
size: 0 B
|
||||
size: 0B
|
||||
|
||||
`, expectedTime, expectedTime),
|
||||
},
|
||||
|
@ -333,8 +333,8 @@ func TestContainerContextWriteJSON(t *testing.T) {
|
|||
}
|
||||
expectedCreated := time.Unix(unix, 0).String()
|
||||
expectedJSONs := []map[string]interface{}{
|
||||
{"Command": "\"\"", "CreatedAt": expectedCreated, "ID": "containerID1", "Image": "ubuntu", "Labels": "", "LocalVolumes": "0", "Mounts": "", "Names": "foobar_baz", "Networks": "", "Ports": "", "RunningFor": "About a minute", "Size": "0 B", "Status": ""},
|
||||
{"Command": "\"\"", "CreatedAt": expectedCreated, "ID": "containerID2", "Image": "ubuntu", "Labels": "", "LocalVolumes": "0", "Mounts": "", "Names": "foobar_bar", "Networks": "", "Ports": "", "RunningFor": "About a minute", "Size": "0 B", "Status": ""},
|
||||
{"Command": "\"\"", "CreatedAt": expectedCreated, "ID": "containerID1", "Image": "ubuntu", "Labels": "", "LocalVolumes": "0", "Mounts": "", "Names": "foobar_baz", "Networks": "", "Ports": "", "RunningFor": "About a minute", "Size": "0B", "Status": ""},
|
||||
{"Command": "\"\"", "CreatedAt": expectedCreated, "ID": "containerID2", "Image": "ubuntu", "Labels": "", "LocalVolumes": "0", "Mounts": "", "Names": "foobar_bar", "Networks": "", "Ports": "", "RunningFor": "About a minute", "Size": "0B", "Status": ""},
|
||||
}
|
||||
out := bytes.NewBufferString("")
|
||||
err := ContainerWrite(Context{Format: "{{json .}}", Output: out}, containers)
|
||||
|
|
|
@ -34,7 +34,7 @@ func TestImageContext(t *testing.T) {
|
|||
{imageContext{
|
||||
i: types.ImageSummary{Size: 10, VirtualSize: 10},
|
||||
trunc: true,
|
||||
}, "10 B", sizeHeader, ctx.Size},
|
||||
}, "10B", sizeHeader, ctx.Size},
|
||||
{imageContext{
|
||||
i: types.ImageSummary{Created: unix},
|
||||
trunc: true,
|
||||
|
@ -109,9 +109,9 @@ func TestImageContextWrite(t *testing.T) {
|
|||
},
|
||||
},
|
||||
`REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
image tag1 imageID1 24 hours ago 0 B
|
||||
image tag2 imageID2 24 hours ago 0 B
|
||||
<none> <none> imageID3 24 hours ago 0 B
|
||||
image tag1 imageID1 24 hours ago 0B
|
||||
image tag2 imageID2 24 hours ago 0B
|
||||
<none> <none> imageID3 24 hours ago 0B
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
@ -159,9 +159,9 @@ image <none>
|
|||
Digest: true,
|
||||
},
|
||||
`REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
|
||||
image tag1 sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf imageID1 24 hours ago 0 B
|
||||
image tag2 <none> imageID2 24 hours ago 0 B
|
||||
<none> <none> <none> imageID3 24 hours ago 0 B
|
||||
image tag1 sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf imageID1 24 hours ago 0B
|
||||
image tag2 <none> imageID2 24 hours ago 0B
|
||||
<none> <none> <none> imageID3 24 hours ago 0B
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
@ -184,19 +184,19 @@ image tag2 <none>
|
|||
tag: tag1
|
||||
image_id: imageID1
|
||||
created_at: %s
|
||||
virtual_size: 0 B
|
||||
virtual_size: 0B
|
||||
|
||||
repository: image
|
||||
tag: tag2
|
||||
image_id: imageID2
|
||||
created_at: %s
|
||||
virtual_size: 0 B
|
||||
virtual_size: 0B
|
||||
|
||||
repository: <none>
|
||||
tag: <none>
|
||||
image_id: imageID3
|
||||
created_at: %s
|
||||
virtual_size: 0 B
|
||||
virtual_size: 0B
|
||||
|
||||
`, expectedTime, expectedTime, expectedTime),
|
||||
},
|
||||
|
@ -212,21 +212,21 @@ tag: tag1
|
|||
digest: sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
|
||||
image_id: imageID1
|
||||
created_at: %s
|
||||
virtual_size: 0 B
|
||||
virtual_size: 0B
|
||||
|
||||
repository: image
|
||||
tag: tag2
|
||||
digest: <none>
|
||||
image_id: imageID2
|
||||
created_at: %s
|
||||
virtual_size: 0 B
|
||||
virtual_size: 0B
|
||||
|
||||
repository: <none>
|
||||
tag: <none>
|
||||
digest: <none>
|
||||
image_id: imageID3
|
||||
created_at: %s
|
||||
virtual_size: 0 B
|
||||
virtual_size: 0B
|
||||
|
||||
`, expectedTime, expectedTime, expectedTime),
|
||||
},
|
||||
|
|
|
@ -22,16 +22,16 @@ func TestContainerStatsContext(t *testing.T) {
|
|||
{StatsEntry{Container: containerID}, "", containerID, containerHeader, ctx.Container},
|
||||
{StatsEntry{CPUPercentage: 5.5}, "", "5.50%", cpuPercHeader, ctx.CPUPerc},
|
||||
{StatsEntry{CPUPercentage: 5.5, IsInvalid: true}, "", "--", cpuPercHeader, ctx.CPUPerc},
|
||||
{StatsEntry{NetworkRx: 0.31, NetworkTx: 12.3}, "", "0.31 B / 12.3 B", netIOHeader, ctx.NetIO},
|
||||
{StatsEntry{NetworkRx: 0.31, NetworkTx: 12.3}, "", "0.31B / 12.3B", netIOHeader, ctx.NetIO},
|
||||
{StatsEntry{NetworkRx: 0.31, NetworkTx: 12.3, IsInvalid: true}, "", "--", netIOHeader, ctx.NetIO},
|
||||
{StatsEntry{BlockRead: 0.1, BlockWrite: 2.3}, "", "0.1 B / 2.3 B", blockIOHeader, ctx.BlockIO},
|
||||
{StatsEntry{BlockRead: 0.1, BlockWrite: 2.3}, "", "0.1B / 2.3B", blockIOHeader, ctx.BlockIO},
|
||||
{StatsEntry{BlockRead: 0.1, BlockWrite: 2.3, IsInvalid: true}, "", "--", blockIOHeader, ctx.BlockIO},
|
||||
{StatsEntry{MemoryPercentage: 10.2}, "", "10.20%", memPercHeader, ctx.MemPerc},
|
||||
{StatsEntry{MemoryPercentage: 10.2, IsInvalid: true}, "", "--", memPercHeader, ctx.MemPerc},
|
||||
{StatsEntry{MemoryPercentage: 10.2}, "windows", "--", memPercHeader, ctx.MemPerc},
|
||||
{StatsEntry{Memory: 24, MemoryLimit: 30}, "", "24 B / 30 B", memUseHeader, ctx.MemUsage},
|
||||
{StatsEntry{Memory: 24, MemoryLimit: 30}, "", "24B / 30B", memUseHeader, ctx.MemUsage},
|
||||
{StatsEntry{Memory: 24, MemoryLimit: 30, IsInvalid: true}, "", "-- / --", memUseHeader, ctx.MemUsage},
|
||||
{StatsEntry{Memory: 24, MemoryLimit: 30}, "windows", "24 B", winMemUseHeader, ctx.MemUsage},
|
||||
{StatsEntry{Memory: 24, MemoryLimit: 30}, "windows", "24B", winMemUseHeader, ctx.MemUsage},
|
||||
{StatsEntry{PidsCurrent: 10}, "", "10", pidsHeader, ctx.PIDs},
|
||||
{StatsEntry{PidsCurrent: 10, IsInvalid: true}, "", "--", pidsHeader, ctx.PIDs},
|
||||
{StatsEntry{PidsCurrent: 10}, "windows", "--", pidsHeader, ctx.PIDs},
|
||||
|
@ -68,7 +68,7 @@ func TestContainerStatsContextWrite(t *testing.T) {
|
|||
{
|
||||
Context{Format: "table {{.MemUsage}}"},
|
||||
`MEM USAGE / LIMIT
|
||||
20 B / 20 B
|
||||
20B / 20B
|
||||
-- / --
|
||||
`,
|
||||
},
|
||||
|
@ -128,7 +128,7 @@ func TestContainerStatsContextWriteWindows(t *testing.T) {
|
|||
{
|
||||
Context{Format: "table {{.MemUsage}}"},
|
||||
`PRIV WORKING SET
|
||||
20 B
|
||||
20B
|
||||
-- / --
|
||||
`,
|
||||
},
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
func TestMemBytesString(t *testing.T) {
|
||||
var mem opts.MemBytes = 1048576
|
||||
assert.Equal(t, mem.String(), "1 MiB")
|
||||
assert.Equal(t, mem.String(), "1MiB")
|
||||
}
|
||||
|
||||
func TestMemBytesSetAndValue(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue