diff --git a/pkg/util/names/names_test.go b/pkg/util/names/names_test.go index 2dc495b3a..165619b55 100644 --- a/pkg/util/names/names_test.go +++ b/pkg/util/names/names_test.go @@ -76,3 +76,27 @@ func TestGetClusterName(t *testing.T) { }) } } + +func TestGenerateBindingReferenceKey(t *testing.T) { + tests := []struct { + name string + namespace string + }{ + {name: "mytest-deployment", + namespace: "prod-xxx", + }, + {name: "mytest-deployment", + namespace: "qa-xxx", + }, + } + result := map[string]struct{}{} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := GenerateBindingReferenceKey(tt.namespace, tt.name) + if _, ok := result[got]; ok { + t.Errorf("duplicate key found %v", got) + } + result[got] = struct{}{} + }) + } +}