Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust to golangci-lint 1.56.0 #1504

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/agent/controller/service_endpoint_slices.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func startEndpointSliceController(localClient dynamic.Interface, restMapper meta
}))

retList := make([]runtime.Object, 0, len(list))

for _, o := range list {
eps := o.(*discovery.EndpointSlice)
retList = append(retList, &discovery.EndpointSlice{
Expand Down
3 changes: 2 additions & 1 deletion pkg/agent/controller/service_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ func (c *ServiceImportController) start(stopCh <-chan struct{}) error {
func (c *ServiceImportController) reconcileRemoteAggregatedServiceImports() {
c.localSyncer.Reconcile(func() []runtime.Object {
siList := c.remoteSyncer.ListResources()

retList := make([]runtime.Object, 0, len(siList))

for i := range siList {
si := c.converter.toServiceImport(siList[i])

Expand Down Expand Up @@ -193,6 +193,7 @@ func (c *ServiceImportController) reconcileLocalAggregatedServiceImports() {
}

retList := make([]runtime.Object, 0, len(siList.Items))

for i := range siList.Items {
si := c.converter.toServiceImport(&siList.Items[i])

Expand Down
3 changes: 3 additions & 0 deletions test/e2e/discovery/headless_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,16 @@ func verifyHeadlessSRVRecordsWithDig(f *framework.Framework, cluster framework.C
return stdout, nil
}, func(result interface{}) (bool, string, error) {
By(fmt.Sprintf("Validating that dig result %s %q", op, result))

if len(hostNameList) == 0 && result != "" {
return false, fmt.Sprintf("expected execution result %q to be empty", result), nil
}

for _, hostName := range hostNameList {
hostDNS := hostName + "." + domainName
doesContain := strings.Contains(result.(string), strconv.Itoa(int(port.Port))) &&
strings.Contains(result.(string), hostDNS)

if doesContain && !shouldContain {
framework.Logf("expected execution result %q not to contain %q and %d", result, hostDNS, int(port.Port))
return false, fmt.Sprintf("expected execution result %q not to contain %q and %d", result, hostDNS, int(port.Port)), nil
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/discovery/service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,13 +608,15 @@ func verifySRVWithDig(f *framework.Framework, srcCluster framework.ClusterIndex,

By(fmt.Sprintf("Validating that port in dig result for SRV Record %q %s %d and the domain name %s %q", result,
op, port.Port, op, clusterDNSName))

if doesContain && !shouldContain {
return false, fmt.Sprintf("expected execution result %q not to contain %d", result, port.Port), nil
}

if !doesContain && shouldContain {
return false, fmt.Sprintf("expected execution result %q to contain %q", result, port.Port), nil
}

return true, "", nil
})
}
Expand Down Expand Up @@ -657,6 +659,7 @@ func verifyRoundRobinWithDig(f *framework.Framework, srcCluster framework.Cluste
if strings.Contains(result.(string), serviceIP) {
serviceIPMap[serviceIP]++
retIPs = append(retIPs, serviceIP)

break
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/discovery/statefulsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func RunSSDiscoveryLocalTest(f *lhframework.Framework) {
for j := range endpointSlice.Endpoints {
verifyEndpointsWithDig(f, framework.ClusterA, netshootPodList, &endpointSlice.Endpoints[j], sourceCluster,
nginxServiceClusterB, checkedDomains, sourceCluster == clusterAName, sourceCluster == clusterAName)

verifyCount++
}
}
Expand Down Expand Up @@ -204,6 +205,7 @@ func verifyEndpointSlices(f *lhframework.Framework, targetCluster framework.Clus
for j := range endpointSlice.Endpoints {
verifyEndpointsWithDig(f, targetCluster, netshootPodList, &endpointSlice.Endpoints[j], sourceCluster,
service, checkedDomains, shouldContain, sourceCluster == localClusterName)

count++
}
}
Expand Down
17 changes: 11 additions & 6 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ func (f *Framework) AwaitEndpointIPs(targetCluster framework.ClusterIndex, name,
}
}
}

if count != anyCount && len(ipList) != count {
return false, fmt.Sprintf("endpoints have %d IPs when expected %d", len(ipList), count), nil
}

return true, "", nil
})

Expand Down Expand Up @@ -580,8 +582,8 @@ func (f *Framework) GetHealthCheckIPInfo(cluster framework.ClusterIndex) (endpoi

var found bool
var err error
healthCheckIP, found, err = unstructured.NestedString(endpoint.Object, "spec", "healthCheckIP")

healthCheckIP, found, err = unstructured.NestedString(endpoint.Object, "spec", "healthCheckIP")
if err != nil {
return false, "", err
}
Expand All @@ -591,6 +593,7 @@ func (f *Framework) GetHealthCheckIPInfo(cluster framework.ClusterIndex) (endpoi
}
}
}

return true, "", nil
})

Expand All @@ -604,20 +607,19 @@ func (f *Framework) GetHealthCheckEnabledInfo(cluster framework.ClusterIndex) (h
return unstructuredSubmarinerConfig, err
}, func(result interface{}) (bool, string, error) {
unstructuredSubmarinerConfig := result.(*unstructured.Unstructured)

By(fmt.Sprintf("Getting the Submariner Config, for cluster %s", framework.TestContext.ClusterIDs[cluster]))

var found bool
var err error

healthCheckEnabled, found, err = unstructured.NestedBool(unstructuredSubmarinerConfig.Object,
"spec", "connectionHealthCheck", "enabled")

if err != nil {
return false, "", err
}

if !found {
return true, "", nil
}
return true, "", nil
return found, "", nil
})

return healthCheckEnabled
Expand Down Expand Up @@ -683,6 +685,7 @@ func (f *Framework) VerifyIPWithDig(srcCluster framework.ClusterIndex, service *
}, func(result interface{}) (bool, string, error) {
doesContain := strings.Contains(result.(string), serviceIP)
By(fmt.Sprintf("Validating that dig result %q %s %q", result, op, serviceIP))

if doesContain && !shouldContain {
return false, fmt.Sprintf("expected execution result %q not to contain %q", result, serviceIP), nil
}
Expand Down Expand Up @@ -731,9 +734,11 @@ func (f *Framework) VerifyIPsWithDig(cluster framework.ClusterIndex, service *v1
return stdout, nil
}, func(result interface{}) (bool, string, error) {
By(fmt.Sprintf("Validating that dig result %s %q", op, result))

if len(ipList) == 0 && result != "" {
return false, fmt.Sprintf("expected execution result %q to be empty", result), nil
}

for _, ip := range ipList {
count := strings.Count(result.(string), ip)
if count > 0 && !shouldContain {
Expand Down
Loading