Skip to content

Commit a052007

Browse files
author
Atanas Chuchev
committed
Refactor label and annotation filter tests for consistency in ConfigDynamic
1 parent d278758 commit a052007

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

pkg/datagatherer/k8sdynamic/dynamic_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,8 +1483,8 @@ func TestDynamicGatherer_Fetch_WithLabelFilters(t *testing.T) {
14831483
}{
14841484
"include labels - key and value match for conjur.org/name": {
14851485
config: ConfigDynamic{
1486-
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1487-
IncludeResourcesByLabels: map[string]string{"conjur.org/name": "conjur-connect-configmap"},
1486+
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1487+
IncludeResourcesByLabels: map[string]string{"conjur.org/name": "conjur-connect-configmap"},
14881488
},
14891489
addObjects: []runtime.Object{
14901490
getObjectAnnot("test.io/v1", "TestResource", "res-with-matching-label", "default", nil, map[string]any{"conjur.org/name": "conjur-connect-configmap"}),
@@ -1500,8 +1500,8 @@ func TestDynamicGatherer_Fetch_WithLabelFilters(t *testing.T) {
15001500
},
15011501
"include labels - key and value match": {
15021502
config: ConfigDynamic{
1503-
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1504-
IncludeResourcesByLabels: map[string]string{"app": "myapp"},
1503+
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1504+
IncludeResourcesByLabels: map[string]string{"app": "myapp"},
15051505
},
15061506
addObjects: []runtime.Object{
15071507
getObjectAnnot("test.io/v1", "TestResource", "res-app-myapp", "default", nil, map[string]any{"app": "myapp"}),
@@ -1516,8 +1516,8 @@ func TestDynamicGatherer_Fetch_WithLabelFilters(t *testing.T) {
15161516
},
15171517
"exclude labels - key only match": {
15181518
config: ConfigDynamic{
1519-
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1520-
ExcludeResourcesByLabels: map[string]string{"internal": ""},
1519+
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1520+
ExcludeResourcesByLabels: map[string]string{"internal": ""},
15211521
},
15221522
addObjects: []runtime.Object{
15231523
getObjectAnnot("test.io/v1", "TestResource", "res-internal", "default", nil, map[string]any{"internal": "true"}),
@@ -1532,8 +1532,8 @@ func TestDynamicGatherer_Fetch_WithLabelFilters(t *testing.T) {
15321532
},
15331533
"exclude labels - key and value match": {
15341534
config: ConfigDynamic{
1535-
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1536-
ExcludeResourcesByLabels: map[string]string{"env": "test"},
1535+
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1536+
ExcludeResourcesByLabels: map[string]string{"env": "test"},
15371537
},
15381538
addObjects: []runtime.Object{
15391539
getObjectAnnot("test.io/v1", "TestResource", "res-env-test", "default", nil, map[string]any{"env": "test"}),
@@ -1598,8 +1598,8 @@ func TestDynamicGatherer_Fetch_WithAnnotationFilters(t *testing.T) {
15981598
}{
15991599
"include annotations - key only match": {
16001600
config: ConfigDynamic{
1601-
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1602-
IncludeResourcesByAnnotations: map[string]string{"prometheus.io/scrape": ""},
1601+
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1602+
IncludeResourcesByAnnotations: map[string]string{"prometheus.io/scrape": ""},
16031603
},
16041604
addObjects: []runtime.Object{
16051605
getObjectAnnot("test.io/v1", "TestResource", "res-with-annot", "default", map[string]any{"prometheus.io/scrape": "true"}, nil),
@@ -1609,8 +1609,8 @@ func TestDynamicGatherer_Fetch_WithAnnotationFilters(t *testing.T) {
16091609
},
16101610
"exclude annotations - key and value match": {
16111611
config: ConfigDynamic{
1612-
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1613-
ExcludeResourcesByAnnotations: map[string]string{"deprecated": "true"},
1612+
GroupVersionResource: schema.GroupVersionResource{Group: "test.io", Version: "v1", Resource: "testresources"},
1613+
ExcludeResourcesByAnnotations: map[string]string{"deprecated": "true"},
16141614
},
16151615
addObjects: []runtime.Object{
16161616
getObjectAnnot("test.io/v1", "TestResource", "res-deprecated", "default", map[string]any{"deprecated": "true"}, nil),

0 commit comments

Comments
 (0)