From ccc1a9b6e14081497965d1e232f6c54430d381bc Mon Sep 17 00:00:00 2001 From: Abbas Gheydi Date: Sat, 7 Sep 2024 11:36:29 +0330 Subject: [PATCH] chore: improve naming in tests --- internal/controller/service/helpers.go | 3 +-- internal/controller/service/helpers_test.go | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/controller/service/helpers.go b/internal/controller/service/helpers.go index 63d0f23..65d0190 100644 --- a/internal/controller/service/helpers.go +++ b/internal/controller/service/helpers.go @@ -51,8 +51,7 @@ var ( ) func init() { - err := cilium_labelsfilter.ParseLabelPrefixCfg([]string{""}, "") - if err != nil { + if err := cilium_labelsfilter.ParseLabelPrefixCfg([]string{""}, ""); err != nil { log.Log.Info("error preparing cilium label filters", "error", err) } } diff --git a/internal/controller/service/helpers_test.go b/internal/controller/service/helpers_test.go index d854e65..ef57d4a 100644 --- a/internal/controller/service/helpers_test.go +++ b/internal/controller/service/helpers_test.go @@ -35,15 +35,15 @@ func TestBuildCNP_LabelFilter(t *testing.T) { want map[string]string }{ - {name: "ShuoldNotBeFiltered", + {name: "ShouldNotBeFiltered", given: map[string]string{"app": "test", "stack": "backend"}, want: map[string]string{"k8s.app": "test", "k8s.stack": "backend"}}, - {name: "ShuoldBeFiltered", + {name: "ShouldBeFiltered_statefulset.kubernetes.io/pod-name", given: map[string]string{"statefulset.kubernetes.io/pod-name": "test", "stack": "backend"}, want: map[string]string{"k8s.stack": "backend"}}, - {name: "ShuoldBeFiltered", + {name: "ShouldBeFiltered_k8s.io", given: map[string]string{"k8s.io/fake": "test", "stack": "backend"}, want: map[string]string{"k8s.stack": "backend"}}, }