Merge pull request #1013 from pigletfly/fix-rb-key

Fix generate rb key
Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
This commit is contained in:
Hongcai Ren 2021-11-24 10:57:46 +08:00 committed by GitHub
commit aa393c2efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions

View File

@ -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{}{}
})
}
}