Skip to content

Commit

Permalink
run goimports (which runs gofmt)
Browse files Browse the repository at this point in the history
  • Loading branch information
asauber committed May 3, 2019
1 parent ac2c1c2 commit a747fa1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
5 changes: 3 additions & 2 deletions e2e/test/ccm_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package test
import (
"e2e_test/test/framework"
"flag"
"github.com/linode/linodego"
"golang.org/x/oauth2"
"net/http"
"os"
"path/filepath"
"testing"
"time"

"github.com/linode/linodego"
"golang.org/x/oauth2"

"github.com/appscode/go/crypto/rand"
"github.com/onsi/ginkgo/reporters"
"k8s.io/client-go/kubernetes"
Expand Down
4 changes: 2 additions & 2 deletions e2e/test/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func New(
linodeClient linodego.Client,
) *Framework {
return &Framework{
restConfig: restConfig,
kubeClient: kubeClient,
restConfig: restConfig,
kubeClient: kubeClient,
linodeClient: linodeClient,

name: "cloud-controller-manager",
Expand Down
19 changes: 10 additions & 9 deletions e2e/test/framework/loadbalancer_suit.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package framework
import (
"context"
"fmt"

"github.com/appscode/go/wait"
"github.com/linode/linodego"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -14,27 +15,27 @@ func (i *lbInvocation) GetHTTPEndpoints() ([]string, error) {

func (i *lbInvocation) getNodeBalancerID(svcName string) (int, error) {
ip, err := i.waitForLoadBalancerIP(svcName)
if err != nil{
if err != nil {
return -1, err
}

nbList, err := i.linodeClient.ListNodeBalancers(context.Background(), nil)

for _, nb := range nbList{
if *nb.IPv4 == ip{
for _, nb := range nbList {
if *nb.IPv4 == ip {
return nb.ID, nil
}
}
return -1, fmt.Errorf("no NodeBalancer Found for service %v",svcName)
return -1, fmt.Errorf("no NodeBalancer Found for service %v", svcName)
}

func (i *lbInvocation) GetNodeBalancerConfig(svcName string) (*linodego.NodeBalancerConfig, error) {
id, err := i.getNodeBalancerID(svcName)
if err != nil{
if err != nil {
return nil, err
}
nbcList, err := i.linodeClient.ListNodeBalancerConfigs(context.Background(), id, nil)
if err != nil{
if err != nil {
return nil, err
}
return &nbcList[0], nil
Expand All @@ -44,16 +45,16 @@ func (i *lbInvocation) waitForLoadBalancerIP(svcName string) (string, error) {
var ip string
err := wait.PollImmediate(RetryInterval, RetryTimout, func() (bool, error) {
svc, err := i.kubeClient.CoreV1().Services(i.Namespace()).Get(svcName, metav1.GetOptions{})
if err != nil{
if err != nil {
return false, err
}

if svc.Status.LoadBalancer.Ingress == nil{
if svc.Status.LoadBalancer.Ingress == nil {
return false, nil
}
ip = svc.Status.LoadBalancer.Ingress[0].IP
return true, nil
})

return ip, err
}
}
6 changes: 3 additions & 3 deletions e2e/test/framework/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func (i *lbInvocation) CreateService(selector, annotations map[string]string, po
},
},
Spec: core.ServiceSpec{
Ports: ports,
Selector: selector,
Type: core.ServiceTypeLoadBalancer,
Ports: ports,
Selector: selector,
Type: core.ServiceTypeLoadBalancer,
SessionAffinity: sessionAffinity,
},
}
Expand Down

0 comments on commit a747fa1

Please sign in to comment.