mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
cleanup(controller): use IsSuperset to avoid interim slice
This commit is contained in:
parent
d6fe718e19
commit
84ff621309
@ -35,7 +35,7 @@ func CheckQueueEq(lhs []string, rhs TimedQueue) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CheckSetEq(lhs, rhs sets.String) 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) {
|
func TestAddNode(t *testing.T) {
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
@ -797,7 +797,7 @@ func TestSyncResourceQuota(t *testing.T) {
|
|||||||
for _, action := range kubeClient.Actions() {
|
for _, action := range kubeClient.Actions() {
|
||||||
actionSet.Insert(strings.Join([]string{action.GetVerb(), action.GetResource().Resource, action.GetSubresource()}, "-"))
|
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))
|
t.Errorf("test: %s,\nExpected actions:\n%v\n but got:\n%v\nDifference:\n%v", testName, testCase.expectedActionSet, actionSet, testCase.expectedActionSet.Difference(actionSet))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user