-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 the bug #2799, add prefix (?i) in rewrite statement. #2808
Conversation
@antoineco Hi, please check it. |
@dongqi1990 please add e2e tests for this change. Thanks |
@aledbf ok, You means that I should modify the rewrite statement in template_test.go, like |
No, I mean, you need to add new e2e tests to check this works with a running ingress controller. Doing unit tests for this is not enough. |
Also, you need to change the mentioned unit tests |
Codecov Report
@@ Coverage Diff @@
## master #2808 +/- ##
=======================================
Coverage 47.47% 47.47%
=======================================
Files 75 75
Lines 5413 5413
=======================================
Hits 2570 2570
Misses 2519 2519
Partials 324 324
Continue to review full report at Codecov.
|
@aledbf @antoineco I had modify the unit test template_test.go and e2e test file rewrite_log.go. Please check it. |
Thanks for that. We also need to test this with an actual HTTP request (see other e2e examples), eg. with capital letters in the request, and assert the response looks as expected. |
@antoineco OK, I had two question to ask you.
|
@dongqi1990 sorry I totally missed your response! 🙇 I don't have formal instructions for writing e2e tests but if you look in the directory you mentioned you will find out that all tests follow the same logic:
I can adapt the test for you if you want to see how I would do it, or do you prefer to give it a try yourself? |
@antoineco Thank you very much for your kindness. I had ran the e2e test in my local machine and sometimes it works and sometimes it doesn't. Oh, I also worked very slowly. |
Will do it today and notify you. |
OK, ^_^ |
Sorry I don't have enough permissions to push to your branch, so I'll send you a patch |
@antoineco My email is [email protected]. Thanks |
Actually no need for email, GitHub can perfectly generate patches: [PATCH] Add e2e test for rewrite-target annotation. All you have to do is execute |
OK, I will study the code these days. |
@dongqi1990 I'm re-running e2e tests. |
@antoineco I'm curious that the same code sometimes goes through the e2e test and sometimes doesn't. Why? |
Mostly the randomness and instability of public CI environments, most of the time it's just a timing issue. If the same test fails often we try to mitigate timing issues with extra wait conditions, etc. But usually it's pretty stable. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: antoineco, dongqi1990 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 |
the location in nginx.conf is case insensitive, but when we use the annotation
nginx.ingress.kubernetes.io/rewrite-target
in ingress rule. the rewrite statement is case sensitive. so we can fix this bug in adding(?i)
in rewrite statement.fixes #2799