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

e2e: Loop more to defeat service randomization #19046

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/e2e/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1335,9 +1335,11 @@ func verifyServeHostnameServiceUp(c *client.Client, ns, host string, expectedPod
defer func() {
deletePodOrFail(c, ns, execPodName)
}()
// Loop a bunch of times - the proxy is randomized, so we want a good
// chance of hitting each backend at least once.
command := fmt.Sprintf(
"for i in $(seq 1 %d); do wget -q -T 1 -O - http://%s:%d || true; echo; done",
3*len(expectedPods), serviceIP, servicePort)
50*len(expectedPods), serviceIP, servicePort)

commands := []func() string{
// verify service from node
Expand Down Expand Up @@ -1367,9 +1369,7 @@ func verifyServeHostnameServiceUp(c *client.Client, ns, host string, expectedPod
for _, cmdFunc := range commands {
passed := false
pods := []string{}
// Retry cmdFunc for upto 5 minutes.
// TODO: make this stricter. Ideally hitting a Service with n pods n
// times should round robing to each pod, and one pass should suffice.
// Retry cmdFunc for a while
for start := time.Now(); time.Since(start) < time.Minute; time.Sleep(5 * time.Second) {
pods = strings.Split(strings.TrimSpace(cmdFunc()), "\n")
// Uniq pods before the sort because inserting them into a set
Expand Down