Lint go code (#5132)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-02-19 21:43:14 -03:00 committed by GitHub
parent f6c0faa6eb
commit 57fcbdfb73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 49 deletions

View file

@ -20,6 +20,7 @@ import (
"strings"
"time"
"github.com/onsi/ginkgo"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"gopkg.in/gavv/httpexpect.v2"
@ -34,8 +35,6 @@ import (
"k8s.io/client-go/kubernetes"
restclient "k8s.io/client-go/rest"
"k8s.io/klog"
"github.com/onsi/ginkgo"
)
// RequestScheme define a scheme used in a test request.
@ -301,6 +300,7 @@ func (f *Framework) SetNginxConfigMapData(cmData map[string]string) {
time.Sleep(5 * time.Second)
}
// CreateConfigMap creates a new configmap in the current namespace
func (f *Framework) CreateConfigMap(name string, data map[string]string) {
_, err := f.KubeClientSet.CoreV1().ConfigMaps(f.Namespace).Create(&v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
@ -349,10 +349,13 @@ func (f *Framework) DeleteNGINXPod(grace int64) {
assert.Nil(ginkgo.GinkgoT(), err, "while waiting for ingress nginx pod to come up again")
}
// HTTPTestClient returns a new httpexpect client for end-to-end HTTP testing.
func (f *Framework) HTTPTestClient() *httpexpect.Expect {
return f.newTestClient(nil)
}
// HTTPTestClientWithTLSConfig returns a new httpexpect client for end-to-end
// HTTP testing with a custom TLS configuration.
func (f *Framework) HTTPTestClientWithTLSConfig(config *tls.Config) *httpexpect.Expect {
return f.newTestClient(config)
}

View file

@ -21,8 +21,7 @@ import (
"os"
"time"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -46,7 +45,7 @@ func nowStamp() string {
}
func log(level string, format string, args ...interface{}) {
fmt.Fprintf(GinkgoWriter, nowStamp()+": "+level+": "+format+"\n", args...)
fmt.Fprintf(ginkgo.GinkgoWriter, nowStamp()+": "+level+": "+format+"\n", args...)
}
// Logf logs to the INFO logs.
@ -58,14 +57,14 @@ func Logf(format string, args ...interface{}) {
func Failf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
log("INFO", msg)
Fail(nowStamp()+": "+msg, 1)
ginkgo.Fail(nowStamp()+": "+msg, 1)
}
// Skipf logs to the INFO logs and skips the test.
func Skipf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
log("INFO", msg)
Skip(nowStamp() + ": " + msg)
ginkgo.Skip(nowStamp() + ": " + msg)
}
// RestclientConfig deserializes the contents of a kubeconfig file into a Config object.