Skip to content

Commit 0e7d422

Browse files
committed
cli/command/formatter: TestContainerPsContext: add test-cases
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent abe4aa7 commit 0e7d422

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

cli/command/formatter/container_test.go

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,51 @@ func TestContainerPsContext(t *testing.T) {
5454
call: ctx.Image,
5555
},
5656
{
57-
container: container.Summary{Image: "verylongimagename"},
57+
container: container.Summary{Image: "ubuntu:latest"},
5858
trunc: true,
59-
expValue: "verylongimagename",
59+
expValue: "ubuntu:latest",
6060
call: ctx.Image,
6161
},
6262
{
63-
container: container.Summary{Image: "verylongimagename"},
64-
expValue: "verylongimagename",
63+
container: container.Summary{Image: "docker.io/library/ubuntu"},
64+
trunc: true,
65+
expValue: "ubuntu",
66+
call: ctx.Image,
67+
},
68+
{
69+
container: container.Summary{Image: "docker.io/library/ubuntu:latest"},
70+
trunc: true,
71+
expValue: "ubuntu:latest",
72+
call: ctx.Image,
73+
},
74+
{
75+
container: container.Summary{Image: "ubuntu:latest@sha256:a5a665ff33eced1e0803148700880edab4269067ed77e27737a708d0d293fbf5"},
76+
trunc: true,
77+
expValue: "ubuntu:latest",
78+
call: ctx.Image,
79+
},
80+
{
81+
container: container.Summary{Image: "ubuntu@sha256:a5a665ff33eced1e0803148700880edab4269067ed77e27737a708d0d293fbf5"},
82+
trunc: true,
83+
expValue: "ubuntu",
84+
call: ctx.Image,
85+
},
86+
{
87+
container: container.Summary{Image: "docker.io/library/ubuntu@sha256:a5a665ff33eced1e0803148700880edab4269067ed77e27737a708d0d293fbf5"},
88+
trunc: true,
89+
expValue: "ubuntu",
90+
call: ctx.Image,
91+
},
92+
{
93+
container: container.Summary{Image: "docker.io/library/ubuntu:latest@sha256:a5a665ff33eced1e0803148700880edab4269067ed77e27737a708d0d293fbf5"},
94+
trunc: true,
95+
expValue: "ubuntu:latest",
96+
call: ctx.Image,
97+
},
98+
{
99+
container: container.Summary{Image: "verylongimagenameverylongimagenameverylongimagenameverylongimagenameverylongimagenameverylongimagenameverylongimagename"},
100+
trunc: true,
101+
expValue: "verylongimagenameverylongimagenameverylongimagenameverylongimagenameverylongimagenameverylongimagenameverylongimagename",
65102
call: ctx.Image,
66103
},
67104
{

0 commit comments

Comments
 (0)