Skip to content

Commit 116a7e2

Browse files
committed
pkg/podman: Simplify code by removing a field from the test cases
Fallout from aa1b533 #1792
1 parent 8755642 commit 116a7e2

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

src/pkg/podman/imageImages_test.go

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ func TestImageImages(t *testing.T) {
3232
}
3333

3434
testCases := []struct {
35-
name string
36-
data string
37-
expects []expect
38-
imagesCount int
35+
name string
36+
data string
37+
expects []expect
3938
}{
4039
{
4140
name: "podman 1.1.2, fedora-toolbox:29",
@@ -76,7 +75,6 @@ func TestImageImages(t *testing.T) {
7675
},
7776
},
7877
},
79-
imagesCount: 2,
8078
},
8179
{
8280
name: "podman 1.8.0, fedora-toolbox:30",
@@ -103,7 +101,6 @@ func TestImageImages(t *testing.T) {
103101
},
104102
},
105103
},
106-
imagesCount: 1,
107104
},
108105
{
109106
name: "podman 2.2.1, fedora-toolbox:32",
@@ -158,7 +155,6 @@ func TestImageImages(t *testing.T) {
158155
},
159156
},
160157
},
161-
imagesCount: 1,
162158
},
163159
{
164160
name: "podman 3.4.7, fedora-toolbox:35",
@@ -219,7 +215,6 @@ func TestImageImages(t *testing.T) {
219215
},
220216
},
221217
},
222-
imagesCount: 1,
223218
},
224219
{
225220
name: "podman 4.9.4, fedora-toolbox:38",
@@ -278,7 +273,6 @@ func TestImageImages(t *testing.T) {
278273
},
279274
},
280275
},
281-
imagesCount: 1,
282276
},
283277
{
284278
name: "podman 4.9.4, fedora-toolbox:38 locally built",
@@ -365,7 +359,6 @@ func TestImageImages(t *testing.T) {
365359
},
366360
},
367361
},
368-
imagesCount: 2,
369362
},
370363
{
371364
name: "podman 4.9.4, fedora-toolbox:38 locally built without a name",
@@ -448,7 +441,6 @@ func TestImageImages(t *testing.T) {
448441
},
449442
},
450443
},
451-
imagesCount: 2,
452444
},
453445
{
454446
name: "podman 4.9.4, fedora-toolbox:39",
@@ -495,7 +487,6 @@ func TestImageImages(t *testing.T) {
495487
},
496488
},
497489
},
498-
imagesCount: 1,
499490
},
500491
{
501492
name: "podman 5.4.2, fedora-toolbox:40",
@@ -554,7 +545,6 @@ func TestImageImages(t *testing.T) {
554545
},
555546
},
556547
},
557-
imagesCount: 1,
558548
},
559549
{
560550
name: "podman 5.4.2, fedora-toolbox:40 with its name removed",
@@ -609,7 +599,6 @@ func TestImageImages(t *testing.T) {
609599
names: nil,
610600
},
611601
},
612-
imagesCount: 1,
613602
},
614603
{
615604
name: "podman 5.4.2, fedora-toolbox:40 and its copy with different registries",
@@ -724,7 +713,6 @@ func TestImageImages(t *testing.T) {
724713
},
725714
},
726715
},
727-
imagesCount: 2,
728716
},
729717
{
730718
name: "podman 5.4.2, fedora-toolbox:40 and its copy with different tags",
@@ -839,7 +827,6 @@ func TestImageImages(t *testing.T) {
839827
},
840828
},
841829
},
842-
imagesCount: 2,
843830
},
844831
{
845832
name: "podman 5.4.2, fedora-toolbox:40, fedora-toolbox:40-aarch64, postgres:latest",
@@ -974,7 +961,6 @@ func TestImageImages(t *testing.T) {
974961
},
975962
},
976963
},
977-
imagesCount: 3,
978964
},
979965
}
980966

@@ -984,7 +970,8 @@ func TestImageImages(t *testing.T) {
984970
var images []imageImages
985971
err := json.Unmarshal(data, &images)
986972
assert.NoError(t, err)
987-
assert.Len(t, images, tc.imagesCount)
973+
expectsCount := len(tc.expects)
974+
assert.Len(t, images, expectsCount)
988975

989976
for i, expect := range tc.expects {
990977
image := images[i]

0 commit comments

Comments
 (0)