Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tero Saarni <[email protected]>
  • Loading branch information
tsaarni committed Nov 4, 2024
1 parent 7a628f6 commit 4c99345
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion internal/dag/httpproxy_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ func (p *HTTPProxyProcessor) computeRoutes(

healthPolicy, err := httpHealthCheckPolicy(route.HealthCheckPolicy)
if err != nil {
validCond.AddErrorf(contour_v1.ConditionTypeRouteError, "HealthCheckPolicyInvalid", err.Error())
validCond.AddError(contour_v1.ConditionTypeRouteError, "HealthCheckPolicyInvalid", err.Error())
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions internal/dag/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5168,7 +5168,7 @@ func TestDAGStatus(t *testing.T) {
})
}

func validGatewayStatusUpdate(listenerName string, listenerProtocol gatewayapi_v1.ProtocolType, attachedRoutes int) []*status.GatewayStatusUpdate {
func validGatewayStatusUpdate(listenerName string, listenerProtocol gatewayapi_v1.ProtocolType, attachedRoutes int32) []*status.GatewayStatusUpdate {
var supportedKinds []gatewayapi_v1.RouteGroupKind

switch listenerProtocol {
Expand Down Expand Up @@ -5218,7 +5218,7 @@ func validGatewayStatusUpdate(listenerName string, listenerProtocol gatewayapi_v
ListenerStatus: map[string]*gatewayapi_v1.ListenerStatus{
listenerName: {
Name: gatewayapi_v1.SectionName(listenerName),
AttachedRoutes: int32(attachedRoutes),
AttachedRoutes: attachedRoutes,
SupportedKinds: supportedKinds,
Conditions: listenerValidConditions(),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/featuretests/v3/featuretests.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (s *StatusResult) Equals(want contour_v1.HTTPProxyStatus) *Contour {
// We should never get an error fetching the status for an
// object, so make it fatal if we do.
if s.Err != nil {
s.T.Fatalf(s.Err.Error())
s.T.Fatal(s.Err.Error())
}

assert.Equal(s.T, want, *s.Have)
Expand All @@ -336,7 +336,7 @@ func (s *StatusResult) Like(want contour_v1.HTTPProxyStatus) *Contour {
// We should never get an error fetching the status for an
// object, so make it fatal if we do.
if s.Err != nil {
s.T.Fatalf(s.Err.Error())
s.T.Fatal(s.Err.Error())
}

if len(want.CurrentStatus) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion internal/provisioner/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (c *Contour) EnvoyTolerationsExist() bool {
}

func (c *Contour) WatchAllNamespaces() bool {
return c.Spec.WatchNamespaces == nil || len(c.Spec.WatchNamespaces) == 0
return len(c.Spec.WatchNamespaces) == 0
}

// ContourSpec defines the desired state of Contour.
Expand Down
2 changes: 1 addition & 1 deletion internal/provisioner/objects/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func DesiredDeployment(contour *model.Contour, image string) *apps_v1.Deployment
args = append(args, fmt.Sprintf("--watch-namespaces=%s", strings.Join(ns, ",")))
}

if contour.Spec.DisabledFeatures != nil && len(contour.Spec.DisabledFeatures) > 0 {
if len(contour.Spec.DisabledFeatures) > 0 {
for _, f := range contour.Spec.DisabledFeatures {
args = append(args, fmt.Sprintf("--disable-feature=%s", string(f)))
}
Expand Down
3 changes: 1 addition & 2 deletions internal/xds/v3/callbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package v3

import (
"context"
"fmt"
"testing"

envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
Expand Down Expand Up @@ -168,7 +167,7 @@ func TestLogDiscoveryRequestDetails(t *testing.T) {
break
}
}
assert.NotNil(t, logEntry, fmt.Sprintf("no log line with expected message %q", tc.expectedLogMsg))
assert.NotNil(t, logEntry, "no log line with expected message %q", tc.expectedLogMsg)
assert.Equal(t, tc.expectedLogData, logEntry.Data)
logHook.Reset()
})
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ var _ = Describe("When upgrading", func() {
poller.Stop()
totalRequests, successfulRequests := poller.Results()
f.T().Logf("Total requests: %d, successful requests: %d\n", totalRequests, successfulRequests)
require.Greater(f.T(), totalRequests, uint(0))
require.Positive(f.T(), totalRequests)
successPercentage := 100 * float64(successfulRequests) / float64(totalRequests)
require.Greaterf(f.T(), successPercentage, float64(90.0), "success rate of %.2f%% less than 90%", successPercentage)
require.Greaterf(f.T(), successPercentage, float64(90.0), "success rate of %.2f%% less than 90%%", successPercentage)
})
})
})
Expand Down Expand Up @@ -292,15 +292,15 @@ var _ = Describe("When upgrading", func() {
poller.Stop()
totalRequests, successfulRequests := poller.Results()
f.T().Logf("Total requests: %d, successful requests: %d\n", totalRequests, successfulRequests)
require.Greater(f.T(), totalRequests, uint(0))
require.Positive(f.T(), totalRequests)
successPercentage := 100 * float64(successfulRequests) / float64(totalRequests)
// Success threshold is somewhat arbitrary but less than the standalone
// Contour upgrade threshold because the Gateway provisioner does not
// currently fully upgrade the control plane before the data plane which
// can lead to additional downtime when both are upgrading at the same
// time.
// ref. https://github.com/projectcontour/contour/issues/5375.
require.Greaterf(f.T(), successPercentage, float64(80.0), "success rate of %.2f%% less than 80%", successPercentage)
require.Greaterf(f.T(), successPercentage, float64(80.0), "success rate of %.2f%% less than 80%%", successPercentage)
})
})
})
Expand Down

0 comments on commit 4c99345

Please sign in to comment.