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

Fix IPv6 e2e test caused by image update #6045

Merged
merged 1 commit into from
Mar 5, 2024
Merged

Conversation

tnqn
Copy link
Member

@tnqn tnqn commented Mar 1, 2024

wget in toolbox image expects the protocol to be specified when IPv6 address is used in the url, otherwise it would use ftp protocol. This patch fixes it and unifies how we get url from IP, port and path.

@tnqn
Copy link
Member Author

tnqn commented Mar 1, 2024

/test-all
/test-ipv6-e2e

test/e2e/util.go Outdated
// getURL("1.2.3.4", "8080") == "http://1.2.3.4:8080"
// getURL("1.2.3.4", "8080", "clientip") == "http://1.2.3.4:8080/clientip"
// getURL("fd74:ca9b:172::b4e", "8080") == "http://[fd74:ca9b:172::b4e]:8080"
func getURL(ip string, args ...string) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a more specific name such as getHttpURLFromIP may be better

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to getHTTPURLFromIPPort

test/e2e/util.go Outdated
@@ -56,3 +56,21 @@ func IPFamily(ip string) string {
return ""
}
}

// getURL returns a HTTP url based on the IP and the addition port and path if provided.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant "additional" and not "addition"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

test/e2e/util.go Outdated
func getURL(ip string, args ...string) string {
port := "80"
if len(args) > 0 {
port = args[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment to highlight that the port need be the first argument if multiple args are provided.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made it an explicit argument

}
cmd := []string{"curl", getURL(testFlow1.dstIP, fmt.Sprint(serverPodPort))}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the port argument is always int or not, if it's always int, maybe add a new parameter to getURL as the second argument, and then we don't have to call the format converter like fmt.Sprint(serverPodPort) every time when there is a port, which can be done inside of the getURL.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

wget in toolbox image expects the protocol to be specified when IPv6
address is used in the url, otherwise it would use ftp protocol. This
patch fixes it and unifies how we get url from IP, port and path.

Signed-off-by: Quan Tian <[email protected]>
@tnqn tnqn requested a review from luolanzone March 5, 2024 02:50
@tnqn
Copy link
Member Author

tnqn commented Mar 5, 2024

/test-e2e
/test-ipv6-e2e
/skip-conformance
/skip-networkpolicy

Copy link
Contributor

@luolanzone luolanzone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tnqn tnqn merged commit f85fe55 into antrea-io:main Mar 5, 2024
50 of 54 checks passed
@tnqn tnqn deleted the fix-ipv6-e2e branch March 5, 2024 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants