Skip to content

Commit

Permalink
Blank line fixes
Browse files Browse the repository at this point in the history
This removes blank lines between error declarations and checks, and
adds blank lines between assignments and code blocks, and before
return statements.

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt authored and tpantelis committed Feb 8, 2024
1 parent 6067ade commit a267b50
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
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
12 changes: 10 additions & 2 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,12 +607,14 @@ 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
}
Expand Down Expand Up @@ -680,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 @@ -728,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

0 comments on commit a267b50

Please sign in to comment.