mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-03 16:16:06 +00:00
prevent the same path load multiple times
Kubernetes-commit: 973e610787db8a9cee5da098e2f72672be817aa9
This commit is contained in:
committed by
Kubernetes Publisher
parent
fff8c3d73e
commit
1ae3aba19b
@@ -592,3 +592,30 @@ func Example_mergingEverythingNoConflicts() {
|
||||
// user:
|
||||
// token: red-token
|
||||
}
|
||||
|
||||
func TestDeduplicate(t *testing.T) {
|
||||
testCases := []struct {
|
||||
src []string
|
||||
expect []string
|
||||
}{
|
||||
{
|
||||
src: []string{"a", "b", "c", "d", "e", "f"},
|
||||
expect: []string{"a", "b", "c", "d", "e", "f"},
|
||||
},
|
||||
{
|
||||
src: []string{"a", "b", "c", "b", "e", "f"},
|
||||
expect: []string{"a", "b", "c", "e", "f"},
|
||||
},
|
||||
{
|
||||
src: []string{"a", "a", "b", "b", "c", "b"},
|
||||
expect: []string{"a", "b", "c"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
get := deduplicate(testCase.src)
|
||||
if !reflect.DeepEqual(get, testCase.expect) {
|
||||
t.Errorf("expect: %v, get: %v", testCase.expect, get)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user