Skip to content

Commit

Permalink
Bump golangci-lint to 1.56.2
Browse files Browse the repository at this point in the history
This adds support for Go 1.22.

Required fixes:
* compare strings with "" instead of checking their length
* ignore an unused function parameter
* various wsl cuddling fixes

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt authored and tpantelis committed Feb 28, 2024
1 parent 0e4d7b8 commit 9d55066
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 204 deletions.
2 changes: 1 addition & 1 deletion test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {

framework.BeforeSuite()
return nil
}, func(data []byte) {
}, func(_ []byte) {
// Run on all Ginkgo nodes
})

Expand Down
2 changes: 2 additions & 0 deletions test/e2e/framework/clusterglobalegressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func AwaitAllocatedEgressIPs(client dynamic.ResourceInterface, name string) []st
if apierrors.IsNotFound(err) {
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}

return resGip, err
},
func(result interface{}) (bool, string, error) {
Expand All @@ -60,6 +61,7 @@ func AwaitAllocatedEgressIPs(client dynamic.ResourceInterface, name string) []st
if len(globalIPs) == 0 {
return false, fmt.Sprintf("Egress IP resource %q exists but allocatedIPs not available yet", name), nil
}

return true, "", nil
})

Expand Down
5 changes: 4 additions & 1 deletion test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func BeforeSuite() {
By("Creating kubernetes clients")

if len(RestConfigs) == 0 {
if len(TestContext.KubeConfig) > 0 {
if TestContext.KubeConfig != "" {
Expect(TestContext.KubeConfigs).To(BeEmpty(),
"Either KubeConfig or KubeConfigs must be specified but not both")

Expand All @@ -182,6 +182,7 @@ func BeforeSuite() {
} else if len(TestContext.KubeConfigs) > 0 {
Expect(TestContext.KubeConfigs).To(HaveLen(len(TestContext.ClusterIDs)),
"One ClusterID must be provided for each item in the KubeConfigs")

for _, kubeConfig := range TestContext.KubeConfigs {
RestConfigs = append(RestConfigs, createRestConfig(kubeConfig, ""))
}
Expand Down Expand Up @@ -570,6 +571,7 @@ func AwaitResultOrError(opMsg string, doOperation DoOperationFunc, checkResult C
if IsTransientError(err, opMsg) {
return false, nil
}

return false, err
}

Expand All @@ -584,6 +586,7 @@ func AwaitResultOrError(opMsg string, doOperation DoOperationFunc, checkResult C
}

lastMsg = msg

return false, nil
})

Expand Down
6 changes: 6 additions & 0 deletions test/e2e/framework/gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ func (f *Framework) AwaitGatewayWithStatus(cluster ClusterIndex, name, status st

gw := result.(*unstructured.Unstructured)
haStatus := NestedString(gw.Object, "status", "haStatus")

if haStatus != status {
return false, fmt.Sprintf("gateway %q exists but has wrong status %q, expected %q", gw.GetName(), haStatus, status), nil
}

return true, "", nil
})

Expand Down Expand Up @@ -105,6 +107,7 @@ func (f *Framework) AwaitGatewayRemoved(cluster ClusterIndex, name string) {
if apierrors.IsNotFound(err) {
return true, nil
}

return false, err
},
func(result interface{}) (bool, string, error) {
Expand All @@ -130,6 +133,7 @@ func (f *Framework) AwaitGatewayFullyConnected(cluster ClusterIndex, name string

gw := result.(*unstructured.Unstructured)
haStatus := NestedString(gw.Object, "status", "haStatus")

if haStatus != "active" {
return false, fmt.Sprintf("Gateway %q exists but not active yet",
gw.GetName()), nil
Expand All @@ -143,6 +147,7 @@ func (f *Framework) AwaitGatewayFullyConnected(cluster ClusterIndex, name string
for _, o := range connections {
conn := o.(map[string]interface{})
status, _, _ := unstructured.NestedString(conn, "status")

if status != "connected" {
return false, fmt.Sprintf("Gateway %q is active but cluster %q is not connected: Status: %q, Message: %q",
name, NestedString(conn, "endpoint", "cluster_id"), status, NestedString(conn, "statusMessage")), nil
Expand Down Expand Up @@ -186,6 +191,7 @@ func (f *Framework) DeleteGateway(cluster ClusterIndex, name string) {
if apierrors.IsNotFound(err) {
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}

return nil, err
}, NoopCheckResult)
}
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/framework/globalingressips.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (f *Framework) AwaitGlobalIngressIP(cluster ClusterIndex, name, namespace s
if apierrors.IsNotFound(err) {
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}

return resGip, err
},
func(result interface{}) (bool, string, error) {
Expand All @@ -56,6 +57,7 @@ func (f *Framework) AwaitGlobalIngressIP(cluster ClusterIndex, name, namespace s
return false, fmt.Sprintf("GlobalIngress %q exists but allocatedIP not available yet",
name), nil
}

return true, "", nil
})

Expand All @@ -73,6 +75,7 @@ func (f *Framework) AwaitGlobalIngressIPRemoved(cluster ClusterIndex, name, name
if apierrors.IsNotFound(err) {
return true, nil
}

return false, err
},
func(result interface{}) (bool, string, error) {
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/framework/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (f *Framework) AwaitRouteAgentPodOnNode(cluster ClusterIndex, nodeName stri
}, func(result interface{}) (bool, string, error) {
pods := result.(*v1.PodList)
var podNodes []string

for i := range pods.Items {
pod := &pods.Items[i]
if pod.Spec.NodeName == nodeName {
Expand All @@ -152,6 +153,7 @@ func (f *Framework) AwaitRouteAgentPodOnNode(cluster ClusterIndex, nodeName stri
}

found = pod

return true, "", nil
}

Expand Down
Loading

0 comments on commit 9d55066

Please sign in to comment.