Merge pull request #115882 from binacs/binacs/controller-use-issuperset

cleanup(controller): use IsSuperset to avoid interim slice
This commit is contained in:
Kubernetes Prow Robot 2023-03-02 17:00:57 -08:00 committed by GitHub
commit 3835c7aecd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ func CheckQueueEq(lhs []string, rhs TimedQueue) bool {
}
func CheckSetEq(lhs, rhs sets.String) bool {
return lhs.HasAll(rhs.List()...) && rhs.HasAll(lhs.List()...)
return lhs.IsSuperset(rhs) && rhs.IsSuperset(lhs)
}
func TestAddNode(t *testing.T) {

View File

@ -26,7 +26,7 @@ import (
"testing"
"time"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@ -797,7 +797,7 @@ func TestSyncResourceQuota(t *testing.T) {
for _, action := range kubeClient.Actions() {
actionSet.Insert(strings.Join([]string{action.GetVerb(), action.GetResource().Resource, action.GetSubresource()}, "-"))
}
if !actionSet.HasAll(testCase.expectedActionSet.List()...) {
if !actionSet.IsSuperset(testCase.expectedActionSet) {
t.Errorf("test: %s,\nExpected actions:\n%v\n but got:\n%v\nDifference:\n%v", testName, testCase.expectedActionSet, actionSet, testCase.expectedActionSet.Difference(actionSet))
}