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 Tests for Proxy Annotations #3149

Merged
merged 2 commits into from
Oct 5, 2018

Conversation

diazjf
Copy link

@diazjf diazjf commented Sep 27, 2018

Adds e2e tests for the following annotations:

  • proxy-body-size
  • proxy-connect-timeout
  • proxy-send-timeout
  • proxy-read-timeout
  • proxy-buffering
  • proxy-buffer-size
  • proxy-request-buffering
  • proxy-next-upstream
  • proxy-next-upstream-tries
  • proxy-cookie-domain
  • proxy-cookie-path

and also updates some documentation.

Fixes #3152

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 27, 2018
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 27, 2018
@diazjf
Copy link
Author

diazjf commented Sep 27, 2018

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 27, 2018
@diazjf diazjf force-pushed the proxy-e2e-tests branch 6 times, most recently from d820a63 to d279415 Compare September 27, 2018 21:36
@ElvinEfendi
Copy link
Member

@diazjf looks like most of these tests share the same logic, can you extract the logic into a helper function and reuse the function instead of duplication?

func(server string) bool {
return Expect(server).Should(ContainSubstring("proxy_read_timeout 20s;"))
})
Expect(err).NotTo(HaveOccurred())
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why you aren't asserting all in the same place? i.e something like

		err = f.WaitForNginxServer(host,
			func(server string) bool {
                                 return strings.Contains(server, "proxy_connect_timeout 50s;") &&  strings.Contains(server, "proxy_send_timeout 20s;") && strings.Contains(server, "proxy_read_timeout 20s;")
			})
		Expect(err).NotTo(HaveOccurred())

Copy link
Author

Choose a reason for hiding this comment

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

I wanted to keep things consistent. Your suggestion makes more sense, it'll make the tests a little faster and its still readable. Thanks 💯

@diazjf diazjf force-pushed the proxy-e2e-tests branch 2 times, most recently from ba5690a to 7fcd0b8 Compare September 28, 2018 02:15
@diazjf
Copy link
Author

diazjf commented Sep 28, 2018

/hold remove

@diazjf
Copy link
Author

diazjf commented Sep 28, 2018

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 28, 2018
},
})
Expect(err).NotTo(HaveOccurred())
Expect(ing).NotTo(BeNil())
Copy link
Member

@ElvinEfendi ElvinEfendi Sep 28, 2018

Choose a reason for hiding this comment

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

I think all these ingress creations with annotations can be extracted into a local helper function to avoid duplication:

somethine like:

func ensureIngress(f *framework.Framework, annotations: map[string]string) *extensions.Ingress

Copy link
Author

Choose a reason for hiding this comment

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

Done, thanks. Will refactor and use this as a util function for other tests in another PR.

Adds e2e tests for the following annotations:

- proxy-body-size
- proxy-connect-timeout
- proxy-send-timeout
- proxy-read-timeout
- proxy-buffering
- proxy-buffer-size
- proxy-request-buffering
- proxy-next-upstream
- proxy-next-upstream-tries
- proxy-cookie-domain
- proxy-cookie-path

and also updates some documentation.
Removes quotes from nginx directives which my cause issues with
their functionality

Fixes kubernetes#3152
@diazjf
Copy link
Author

diazjf commented Oct 1, 2018

@ElvinEfendi good suggestion.

@diazjf
Copy link
Author

diazjf commented Oct 4, 2018

@ElvinEfendi @aledbf this one is good to go 👍

@aledbf
Copy link
Member

aledbf commented Oct 5, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 5, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Oct 5, 2018
@aledbf
Copy link
Member

aledbf commented Oct 5, 2018

@diazjf thanks!

@k8s-ci-robot k8s-ci-robot merged commit b46523a into kubernetes:master Oct 5, 2018
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants