mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
clean up the pattern
This commit is contained in:
parent
3c22575e66
commit
8daf9ec2d4
@ -41,6 +41,7 @@ import (
|
|||||||
fakecloud "k8s.io/cloud-provider/fake"
|
fakecloud "k8s.io/cloud-provider/fake"
|
||||||
servicehelper "k8s.io/cloud-provider/service/helpers"
|
servicehelper "k8s.io/cloud-provider/service/helpers"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/controller"
|
"k8s.io/kubernetes/pkg/controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -346,23 +347,19 @@ func TestSyncLoadBalancerIfNeeded(t *testing.T) {
|
|||||||
t.Errorf("Got no create call for load balancer, expected one")
|
t.Errorf("Got no create call for load balancer, expected one")
|
||||||
}
|
}
|
||||||
|
|
||||||
var isFound bool
|
if len(cloud.Balancers) == 0 {
|
||||||
for _, balancer := range cloud.Balancers {
|
|
||||||
if !reflect.DeepEqual(balancer, fakecloud.Balancer{}) {
|
|
||||||
isFound = true
|
|
||||||
if balancer.Name != controller.balancer.GetLoadBalancerName(context.Background(), "", tc.service) ||
|
|
||||||
balancer.Region != region ||
|
|
||||||
balancer.Ports[0].Port != tc.service.Spec.Ports[0].Port {
|
|
||||||
t.Errorf("Created load balancer has incorrect parameters: %v", balancer)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !isFound {
|
|
||||||
t.Errorf("Got no load balancer: %v, expected one to be created", cloud.Balancers)
|
t.Errorf("Got no load balancer: %v, expected one to be created", cloud.Balancers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, balancer := range cloud.Balancers {
|
||||||
|
if balancer.Name != controller.balancer.GetLoadBalancerName(context.Background(), "", tc.service) ||
|
||||||
|
balancer.Region != region ||
|
||||||
|
balancer.Ports[0].Port != tc.service.Spec.Ports[0].Port {
|
||||||
|
t.Errorf("Created load balancer has incorrect parameters: %v", balancer)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if tc.expectDeleteAttempt {
|
if tc.expectDeleteAttempt {
|
||||||
deleteCallFound := false
|
deleteCallFound := false
|
||||||
for _, call := range cloud.Calls {
|
for _, call := range cloud.Calls {
|
||||||
|
Loading…
Reference in New Issue
Block a user