|
|
@ -32,14 +32,11 @@ func TestIsSystemLabel(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type filterSystemLabelsTest struct {
|
|
|
|
func TestFilterSystemLabels(t *testing.T) {
|
|
|
|
args, expected map[string]string
|
|
|
|
var tests = [][2]map[string]string{
|
|
|
|
}
|
|
|
|
{nil, nil},
|
|
|
|
|
|
|
|
{map[string]string{}, nil},
|
|
|
|
var filterSystemLabelsTests = []filterSystemLabelsTest{
|
|
|
|
{map[string]string{
|
|
|
|
filterSystemLabelsTest{nil, nil},
|
|
|
|
|
|
|
|
filterSystemLabelsTest{map[string]string{}, nil},
|
|
|
|
|
|
|
|
filterSystemLabelsTest{map[string]string{
|
|
|
|
|
|
|
|
"name": "name",
|
|
|
|
"name": "name",
|
|
|
|
"owner": "owner",
|
|
|
|
"owner": "owner",
|
|
|
|
"status": "status",
|
|
|
|
"status": "status",
|
|
|
@ -47,7 +44,7 @@ var filterSystemLabelsTests = []filterSystemLabelsTest{
|
|
|
|
"createdAt": "createdAt",
|
|
|
|
"createdAt": "createdAt",
|
|
|
|
"modifiedAt": "modifiedAt",
|
|
|
|
"modifiedAt": "modifiedAt",
|
|
|
|
}, nil},
|
|
|
|
}, nil},
|
|
|
|
filterSystemLabelsTest{map[string]string{
|
|
|
|
{map[string]string{
|
|
|
|
"StaTus": "status",
|
|
|
|
"StaTus": "status",
|
|
|
|
"name": "name",
|
|
|
|
"name": "name",
|
|
|
|
"owner": "owner",
|
|
|
|
"owner": "owner",
|
|
|
@ -56,7 +53,7 @@ var filterSystemLabelsTests = []filterSystemLabelsTest{
|
|
|
|
"StaTus": "status",
|
|
|
|
"StaTus": "status",
|
|
|
|
"key": "value",
|
|
|
|
"key": "value",
|
|
|
|
}},
|
|
|
|
}},
|
|
|
|
filterSystemLabelsTest{map[string]string{
|
|
|
|
{map[string]string{
|
|
|
|
"key1": "value1",
|
|
|
|
"key1": "value1",
|
|
|
|
"key2": "value2",
|
|
|
|
"key2": "value2",
|
|
|
|
}, map[string]string{
|
|
|
|
}, map[string]string{
|
|
|
@ -64,11 +61,9 @@ var filterSystemLabelsTests = []filterSystemLabelsTest{
|
|
|
|
"key2": "value2",
|
|
|
|
"key2": "value2",
|
|
|
|
}},
|
|
|
|
}},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, test := range tests {
|
|
|
|
func TestFilterSystemLabels(t *testing.T) {
|
|
|
|
if output := filterSystemLabels(test[0]); !reflect.DeepEqual(test[1], output) {
|
|
|
|
for _, test := range filterSystemLabelsTests {
|
|
|
|
t.Errorf("Expected {%v}, got {%v}", test[1], output)
|
|
|
|
if output := filterSystemLabels(test.args); !reflect.DeepEqual(test.expected, output) {
|
|
|
|
|
|
|
|
t.Errorf("Expected {%v}, got {%v}", test.expected, output)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|