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

Add e2e test for round robin load balancing #3390

Merged
merged 1 commit into from
Nov 9, 2018

Conversation

zrdaley
Copy link
Contributor

@zrdaley zrdaley commented Nov 9, 2018

What this PR does / why we need it:

This adds e2e-testing for round robin load balancing.

Which issue this PR fixes: #3303

Special notes for your reviewer:

Sometimes when testing, the request distribution wasn't an equal split three ways. I'm assuming due to a retry occurring.

The acceptable range was added to combat this type of test flakiness: https://github.com/kubernetes/ingress-nginx/pull/3390/files#diff-ea1cd91e199561de47a82f58b325412cR78

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 9, 2018
@aledbf
Copy link
Member

aledbf commented Nov 9, 2018

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2018
@aledbf
Copy link
Member

aledbf commented Nov 9, 2018

@zrdaley thanks!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf, zrdaley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 9, 2018
@k8s-ci-robot k8s-ci-robot merged commit 55104c9 into kubernetes:master Nov 9, 2018
@zrdaley zrdaley deleted the rr-e2e branch November 9, 2018 19:23
_, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Set("Host", host).
Retry(10, 1*time.Second, http.StatusNotFound, http.StatusServiceUnavailable).
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need this? Does the endpoint expected to be flaky?

Set("Host", host).
Retry(10, 1*time.Second, http.StatusNotFound, http.StatusServiceUnavailable).
End()
Expect(len(errs)).Should(BeNumerically("==", 0))
Copy link
Member

@ElvinEfendi ElvinEfendi Nov 12, 2018

Choose a reason for hiding this comment

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

When you do this, the error message is useless. Please use Expect(errs).Should(BeEmpty()) instead (or if you know any better one - the idea is to reveal more about the error not just say n != m).

@ElvinEfendi
Copy link
Member

Sometimes when testing, the request distribution wasn't an equal split three ways. I'm assuming due to a retry occurring.

@zrdaley have you tried with a single Nginx worker? From #3303:

Given single ingress-nginx replica and single Nginx worker the number of requests should be evenly distributed across replicas.

@ElvinEfendi
Copy link
Member

test/e2e/settings/load_balance.go

@zrdaley settings test package seems to be for configmap settings. It's not the right place to put this e2e test for Round Robin load balancing.

I'd suggest something like test/e2e/loadbalance/. Then implement e2e tests for load balancing algorithms there. This one specifically would be test/e2e/loadbalance/round_robin.go

@zrdaley
Copy link
Contributor Author

zrdaley commented Nov 12, 2018

@ElvinEfendi I addressed all of your comments in a new PR: #3407

Initially I thought that the request distribution was off because of bad request responses (hence the Retry and acceptableRequestRange). Using one worker solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants