Skip to content

fix metallb e2e #5183

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

Merged
merged 2 commits into from
Apr 25, 2025
Merged
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions test/e2e/metallb/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@
}

ginkgo.By("checking vip node is same as backend pod's host")
// the arp may not be stable when just started
cmd = strings.Fields(fmt.Sprintf("arping -c 5 %s", targetIP))
output, _, err = docker.Exec(containerID, nil, cmd...)

Check failure on line 382 in test/e2e/metallb/e2e_test.go

View workflow job for this annotation

GitHub Actions / Build kube-ovn

ineffectual assignment to err (ineffassign)
framework.Logf("arping result is %s ", output)

Choose a reason for hiding this comment

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

high

The arping command is executed, and its output is logged, but the code doesn't check if the arping command was successful. It's important to check the error returned by docker.Exec to ensure that arping completed successfully before proceeding with the curl command. If arping fails, the test should fail or retry, rather than continuing with potentially unstable ARP entries. Consider adding a check for err != nil after the docker.Exec call, and failing the test if the error is present.

Suggested change
// the arp may not be stable when just started
cmd = strings.Fields(fmt.Sprintf("arping -c 5 %s", targetIP))
output, _, err = docker.Exec(containerID, nil, cmd...)
framework.Logf("arping result is %s ", output)
// the arp may not be stable when just started
cmd = strings.Fields(fmt.Sprintf("arping -c 5 %s", targetIP))
output, _, err = docker.Exec(containerID, nil, cmd...)
if err != nil {
framework.Failf("arping failed: %v, output: %s", err, output)
}
framework.Logf("arping result is %s ", output)


cmd = strings.Fields(fmt.Sprintf("curl -q -s --connect-timeout 2 --max-time 2 %s/hostname", net.JoinHostPort(targetIP, targetPort)))
output, _, err = docker.Exec(containerID, nil, cmd...)
framework.ExpectNoError(err)
Expand Down
Loading