From 083e66fe2bd0a5c709adf51a8551dcfa80a274b7 Mon Sep 17 00:00:00 2001 From: Dmitry Chepurovskiy Date: Mon, 10 Jan 2022 23:20:34 +0300 Subject: [PATCH] Remove redudant types from util_test.go Signed-off-by: Dmitry Chepurovskiy Signed-off-by: Dmitry Chepurovskiy --- pkg/storage/driver/util_test.go | 67 +++++++++++++++------------------ 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/pkg/storage/driver/util_test.go b/pkg/storage/driver/util_test.go index 557681a81..800049eca 100644 --- a/pkg/storage/driver/util_test.go +++ b/pkg/storage/driver/util_test.go @@ -32,43 +32,38 @@ func TestIsSystemLabel(t *testing.T) { } } -type filterSystemLabelsTest struct { - args, expected map[string]string -} - -var filterSystemLabelsTests = []filterSystemLabelsTest{ - filterSystemLabelsTest{nil, nil}, - filterSystemLabelsTest{map[string]string{}, nil}, - filterSystemLabelsTest{map[string]string{ - "name": "name", - "owner": "owner", - "status": "status", - "version": "version", - "createdAt": "createdAt", - "modifiedAt": "modifiedAt", - }, nil}, - filterSystemLabelsTest{map[string]string{ - "StaTus": "status", - "name": "name", - "owner": "owner", - "key": "value", - }, map[string]string{ - "StaTus": "status", - "key": "value", - }}, - filterSystemLabelsTest{map[string]string{ - "key1": "value1", - "key2": "value2", - }, map[string]string{ - "key1": "value1", - "key2": "value2", - }}, -} - func TestFilterSystemLabels(t *testing.T) { - for _, test := range filterSystemLabelsTests { - if output := filterSystemLabels(test.args); !reflect.DeepEqual(test.expected, output) { - t.Errorf("Expected {%v}, got {%v}", test.expected, output) + var tests = [][2]map[string]string{ + {nil, nil}, + {map[string]string{}, nil}, + {map[string]string{ + "name": "name", + "owner": "owner", + "status": "status", + "version": "version", + "createdAt": "createdAt", + "modifiedAt": "modifiedAt", + }, nil}, + {map[string]string{ + "StaTus": "status", + "name": "name", + "owner": "owner", + "key": "value", + }, map[string]string{ + "StaTus": "status", + "key": "value", + }}, + {map[string]string{ + "key1": "value1", + "key2": "value2", + }, map[string]string{ + "key1": "value1", + "key2": "value2", + }}, + } + for _, test := range tests { + if output := filterSystemLabels(test[0]); !reflect.DeepEqual(test[1], output) { + t.Errorf("Expected {%v}, got {%v}", test[1], output) } } }