|
|
|
@ -32,14 +32,11 @@ 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{
|
|
|
|
|
func TestFilterSystemLabels(t *testing.T) {
|
|
|
|
|
var tests = [][2]map[string]string{
|
|
|
|
|
{nil, nil},
|
|
|
|
|
{map[string]string{}, nil},
|
|
|
|
|
{map[string]string{
|
|
|
|
|
"name": "name",
|
|
|
|
|
"owner": "owner",
|
|
|
|
|
"status": "status",
|
|
|
|
@ -47,7 +44,7 @@ var filterSystemLabelsTests = []filterSystemLabelsTest{
|
|
|
|
|
"createdAt": "createdAt",
|
|
|
|
|
"modifiedAt": "modifiedAt",
|
|
|
|
|
}, nil},
|
|
|
|
|
filterSystemLabelsTest{map[string]string{
|
|
|
|
|
{map[string]string{
|
|
|
|
|
"StaTus": "status",
|
|
|
|
|
"name": "name",
|
|
|
|
|
"owner": "owner",
|
|
|
|
@ -56,19 +53,17 @@ var filterSystemLabelsTests = []filterSystemLabelsTest{
|
|
|
|
|
"StaTus": "status",
|
|
|
|
|
"key": "value",
|
|
|
|
|
}},
|
|
|
|
|
filterSystemLabelsTest{map[string]string{
|
|
|
|
|
{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)
|
|
|
|
|
}
|
|
|
|
|
for _, test := range tests {
|
|
|
|
|
if output := filterSystemLabels(test[0]); !reflect.DeepEqual(test[1], output) {
|
|
|
|
|
t.Errorf("Expected {%v}, got {%v}", test[1], output)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|