Skip to content

Commit

Permalink
network, e2e: Convert skipIfNotSupportedCluster() to a regular function
Browse files Browse the repository at this point in the history
Currently, `skipIfNotSupportedCluster` is defined as an anonymous function.
This function is not a closure [1], and could be defined as a regular
function.

[1] https://go.dev/tour/moretypes/25

Signed-off-by: Orel Misan <[email protected]>
  • Loading branch information
orelmisan committed May 17, 2023
1 parent db8c797 commit a6cabc7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/network/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@ var _ = SIGDescribe("[rfe_id:253][crit:medium][vendor:[email protected]][level:c
virtClient = kubevirt.Client()
})

skipIfNotSupportedCluster := func(ipFamily ipFamily) {
if includesIpv4(ipFamily) {
libnet.SkipWhenClusterNotSupportIpv4()
}
if inlcudesIpv6(ipFamily) {
libnet.SkipWhenClusterNotSupportIpv6()
}
if isDualStack(ipFamily) {
checks.SkipIfVersionBelow("Dual stack service requires v1.20 and above", "1.20")
}
}

appendIpFamilyToExposeArgs := func(ipFamily ipFamily, vmiExposeArgs []string) []string {
if inlcudesIpv6(ipFamily) {
vmiExposeArgs = append(vmiExposeArgs, "--ip-family", string(ipFamily))
Expand Down Expand Up @@ -777,6 +765,18 @@ func validateClusterIp(clusterIp string, ipFamily ipFamily) error {
return nil
}

func skipIfNotSupportedCluster(ipFamily ipFamily) {
if includesIpv4(ipFamily) {
libnet.SkipWhenClusterNotSupportIpv4()
}
if inlcudesIpv6(ipFamily) {
libnet.SkipWhenClusterNotSupportIpv6()
}
if isDualStack(ipFamily) {
checks.SkipIfVersionBelow("Dual stack service requires v1.20 and above", "1.20")
}
}

func getNodeHostname(nodeAddresses []k8sv1.NodeAddress) *string {
for _, address := range nodeAddresses {
if address.Type == k8sv1.NodeHostName {
Expand Down

0 comments on commit a6cabc7

Please sign in to comment.