sfix all golang lint ci errors

This commit is contained in:
James Strong 2023-12-07 15:30:42 -05:00
parent 644a5e96a8
commit afe1a37c38
8 changed files with 16 additions and 8 deletions

View file

@ -197,6 +197,7 @@ github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcs
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE=
github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
github.com/mrunalp/fileutils v0.5.1/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU=
github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo=
github.com/onsi/ginkgo/v2 v2.9.4/go.mod h1:gCQYp2Q+kSoIj7ykSVb9nskRSsR6PUj4AiLywzIhbKM=

View file

@ -125,6 +125,7 @@ func TestSSLPassthrough(t *testing.T) {
ec := NewAnnotationExtractor(mockCfg{})
ing := buildIngress()
//nolint:goconst //already a constant
fooAnns := []struct {
annotations map[string]string
er bool

View file

@ -49,6 +49,8 @@ var (
// IsValidRegex checks if the tested string can be used as a regex, but without any weird character.
// It includes regex characters for paths that may contain regexes
//
//nolint:goconst //already a constant
var IsValidRegex = regexp.MustCompile("^[/" + alphaNumericChars + regexEnabledChars + "]*$")
// SizeRegex validates sizes understood by NGINX, like 1000, 100k, 1000M

View file

@ -425,6 +425,7 @@ http {
f.EnsureIngress(ing2)
f.WaitForNginxServer(host, func(server string) bool {
//nolint:goconst //server_name is a constant
return strings.Contains(server, "server_name "+host)
})
})

View file

@ -40,6 +40,8 @@ const echoHost = "echo"
var _ = framework.DescribeAnnotation("backend-protocol - GRPC", func() {
f := framework.NewDefaultFramework("grpc", framework.WithHTTPBunEnabled())
nginxIPsecure := f.GetNginxIP() + ":443"
ginkgo.It("should use grpc_pass in the configuration file", func() {
f.NewGRPCFortuneTellerDeployment()
@ -103,7 +105,7 @@ var _ = framework.DescribeAnnotation("backend-protocol - GRPC", func() {
return strings.Contains(server, "grpc_pass grpc://upstream_balancer;")
})
conn, err := grpc.Dial(f.GetNginxIP()+":443",
conn, err := grpc.Dial(nginxIPsecure,
grpc.WithTransportCredentials(
credentials.NewTLS(&tls.Config{
ServerName: echoHost,
@ -164,7 +166,7 @@ var _ = framework.DescribeAnnotation("backend-protocol - GRPC", func() {
return strings.Contains(server, "grpc_pass grpc://upstream_balancer;")
})
conn, err := grpc.Dial(f.GetNginxIP()+":443",
conn, err := grpc.Dial(nginxIPsecure,
grpc.WithTransportCredentials(
credentials.NewTLS(&tls.Config{
ServerName: echoHost,
@ -238,7 +240,7 @@ var _ = framework.DescribeAnnotation("backend-protocol - GRPC", func() {
return strings.Contains(server, "grpc_pass grpcs://upstream_balancer;")
})
conn, err := grpc.Dial(f.GetNginxIP()+":443",
conn, err := grpc.Dial(nginxIPsecure,
grpc.WithTransportCredentials(
credentials.NewTLS(&tls.Config{
ServerName: echoHost,

View file

@ -234,8 +234,7 @@ func (r *HTTPResponse) checkContentType(expectedType string, expectedCharset ...
}
if mediaType != expectedType {
r.chain.fail("\nexpected \"Content-Type\" header with %q media type,"+
"\nbut got %q", expectedType, mediaType)
r.chain.fail("\nexpected \"Content-Type\" header with %q media type but got %q", expectedType, mediaType)
return false
}

View file

@ -32,6 +32,7 @@ import (
var _ = framework.IngressNginxDescribe("[Flag] disable-sync-events", func() {
f := framework.NewDefaultFramework("disable-sync-events")
selectorHost := "reason=Sync,involvedObject.name="
ginkgo.It("should create sync events (default)", func() {
host := "sync-events-default"
f.NewEchoDeployment(framework.WithDeploymentReplicas(1))
@ -44,7 +45,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-sync-events", func() {
return strings.Contains(server, fmt.Sprintf("server_name %v", host))
})
events, err := f.KubeClientSet.CoreV1().Events(ing.Namespace).List(context.TODO(), metav1.ListOptions{FieldSelector: "reason=Sync,involvedObject.name=" + host})
events, err := f.KubeClientSet.CoreV1().Events(ing.Namespace).List(context.TODO(), metav1.ListOptions{FieldSelector: selectorHost + host})
assert.Nil(ginkgo.GinkgoT(), err, "listing events")
assert.NotEmpty(ginkgo.GinkgoT(), events.Items, "got events")
@ -72,7 +73,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-sync-events", func() {
return strings.Contains(server, fmt.Sprintf("server_name %v", host))
})
events, err := f.KubeClientSet.CoreV1().Events(ing.Namespace).List(context.TODO(), metav1.ListOptions{FieldSelector: "reason=Sync,involvedObject.name=" + host})
events, err := f.KubeClientSet.CoreV1().Events(ing.Namespace).List(context.TODO(), metav1.ListOptions{FieldSelector: selectorHost + host})
assert.Nil(ginkgo.GinkgoT(), err, "listing events")
assert.NotEmpty(ginkgo.GinkgoT(), events.Items, "got events")
@ -100,7 +101,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-sync-events", func() {
return strings.Contains(server, fmt.Sprintf("server_name %v", host))
})
events, err := f.KubeClientSet.CoreV1().Events(ing.Namespace).List(context.TODO(), metav1.ListOptions{FieldSelector: "reason=Sync,involvedObject.name=" + host})
events, err := f.KubeClientSet.CoreV1().Events(ing.Namespace).List(context.TODO(), metav1.ListOptions{FieldSelector: selectorHost + host})
assert.Nil(ginkgo.GinkgoT(), err, "listing events")
assert.Empty(ginkgo.GinkgoT(), events.Items, "got events")

View file

@ -47,6 +47,7 @@ var _ = framework.DescribeSetting("enable-real-ip", func() {
f.WaitForNginxServer(host,
func(server string) bool {
//nolint:goconst //already a const
return strings.Contains(server, "server_name "+host) &&
!strings.Contains(server, "proxy_set_header X-Forwarded-Proto $full_x_forwarded_proto;")
})