-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 ability to custom handle redirects #5678
base: master
Are you sure you want to change the base?
Add ability to custom handle redirects #5678
Conversation
Welcome @abogdanov37! |
Hi @abogdanov37. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: abogdanov37 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@koba1t @varshaprasad96 Please, check the task may be it has more simple solution than thit PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @abogdanov37
Thanks for your contribution!
I think looks good to me for your codebase.
I add a few comments. Please check that.
So, I think we need to add some tests that check to fix the problem.
Please add some test scenarios to check this problem!
Ok. Next week I'll add tests and work on comments! |
This PR has multiple commits, and the default merge method is: merge. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
52c81db
to
1967df5
Compare
…art working on unit tests.
1967df5
to
f8e3e74
Compare
Hi @koba1t! I have been add test for fileloader. Skip localizer and kusttarget because have no idea how to test override loader there. If you have any idea please share it I'll try to implement |
}, | ||
} | ||
for _, x := range testCaseRedirect { | ||
expectedLocation := "https://redirect.com/resource.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like redirect.com
is owned by a company.
I understand this fakeHttpClient won't access the global internet, but I prefer to use a reserved example domain instead of something that someone else owns.
Domain Name: REDIRECT.COM
Registry Domain ID: 32687398_DOMAIN_COM-VRSN
Registrar WHOIS Server: Whois.bigrock.com
Registrar URL: http://www.bigrock.com
Updated Date: 2023-06-20T20:24:31Z
Creation Date: 2000-08-10T10:33:16Z
Registry Expiry Date: 2024-08-10T10:33:15Z
Registrar: BigRock Solutions Ltd
Registrar IANA ID: 1495
Registrar Abuse Contact Email: abuse@bigrock.com
Registrar Abuse Contact Phone: +1.832-295-1535
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: NS-1118.AWSDNS-11.ORG
Name Server: NS-1717.AWSDNS-22.CO.UK
Name Server: NS-320.AWSDNS-40.COM
Name Server: NS-918.AWSDNS-50.NET
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2024-06-30T18:22:52Z <<<
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ок. I'll fix it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding a test!
So, it looks like your test only checks that the location needs to redirect. I think it's preferable to add a check to ensure that redirect
doesn't happen.
response.Header.Add("Location", expectedLocation) | ||
return response | ||
}) | ||
l2 := l1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does l1
and l2
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is loaders. I use solution from testcase from
l2.http = hc |
var testCaseRedirect = []testData{ | ||
{ | ||
path: "https://example.com/resource.yaml", | ||
expectedContent: "https content", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code below, do you plan to add more tests?
https://github.com/kubernetes-sigs/kustomize/pull/5678/files#diff-e89184db286ae331249443264748758337bf37c3e9c92a32d6102f94aab422f9R686-R690
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no plans to add another tests.
I think that another tests check behavior if redirect is not happened. |
I plan fix all issues today. Thanks for review! |
Hi @koba1t. All highlited issues have been fixed! |
#5675