-
Notifications
You must be signed in to change notification settings - Fork 492
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
added conformance checks for port, scheme and path (extended + experimental features) #1611
added conformance checks for port, scheme and path (extended + experimental features) #1611
Conversation
Hi @LiorLieberman. 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. |
conformance/utils/http/http.go
Outdated
if expected.RedirectRequest.Host == "" { | ||
expected.RedirectRequest.Host = cRes.RedirectRequest.Host | ||
} | ||
|
||
if expected.RedirectRequest.Port == "" { | ||
expected.RedirectRequest.Port = "80" | ||
} | ||
|
||
if expected.RedirectRequest.Scheme == "" { | ||
expected.RedirectRequest.Scheme = "http" | ||
} |
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 do you think about these lines?
I am not 100% sure it is best to take these assumptions
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.
The default for scheme and port made me pause slightly. Unless I'm misunderstanding things we're setting defaults here, conventionally you would (almost?) never redirect to http
so I'm just wondering if we should flip those 🤔
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.
The thing is that I have the checks down there. For example the line 312 - I am checking for scheme.
so when you would run for example a redirect test for Port when expected.RedirectRequest.Scheme
is an empty string (because the implementations should not bother to set Scheme in their expected struct unless they want to check it) then it will fail on the scheme check. Hence I added it.
My understanding is the by default it is http.
For port it is interesting, I will probably need to change it. Now I have tested Path redirect (changes are not in this PR) with envoyGateway other than istio because istio does not yet support it and I noticed that the response is an empty port (not 80 like istio), so "80" is not good default for every impl I guess.
If we decide to set the default to "80" we need to also fill cRes.RedirectRequest.Port
to "80" but not sure thats desired.
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.
The other option I see is setting it to what we get from the expected field if it is an empty string but that also feels a bit iffy - something like this:
if expected.RedirectRequest.Port == "" {
expected.RedirectRequest.Port = cRes.RedirectRequest.Port
}
if expected.RedirectRequest.Scheme == "" {
expected.RedirectRequest.Scheme = cRes.RedirectRequest.Scheme
}
I do have the same thing now for expected.RedirectRequest.Path which I think to add something similar:
if expected.RedirectRequest.Path == "" {
expected.RedirectRequest.Path = cRes.RedirectRequest.Path
}
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.
@youngnick and @robscott curious as to your thoughts here.
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.
My preference is to avoid defaults here, specify what we care about in the test, and only check for that. In this case that would mean lots of repetitive config, but I think it would more clearly communicate what we actually expect from an implementation.
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 made some refactoring - PTAL
/ok-to-test |
/assign @shaneutt |
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 good!
I do have a few things I would like to see addressed before we merge, but they are minor.
conformance/utils/http/http.go
Outdated
if expected.RedirectRequest.Host == "" { | ||
expected.RedirectRequest.Host = cRes.RedirectRequest.Host | ||
} | ||
|
||
if expected.RedirectRequest.Port == "" { | ||
expected.RedirectRequest.Port = "80" | ||
} | ||
|
||
if expected.RedirectRequest.Scheme == "" { | ||
expected.RedirectRequest.Scheme = "http" | ||
} |
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.
The default for scheme and port made me pause slightly. Unless I'm misunderstanding things we're setting defaults here, conventionally you would (almost?) never redirect to http
so I'm just wondering if we should flip those 🤔
@shaneutt Thanks very much for the feedback, I did miss some important things. |
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.
Approving so as to no longer block as most of the issues I brought up were resolved, but would still like a review from @youngnick or @robscott for the final lgtm.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: LiorLieberman, shaneutt 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 |
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.
Thanks @LiorLieberman! A few nits but otherwise LGTM.
I have made a small refactor
PTAL |
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.
Thanks @LiorLieberman, a few tiny nits but otherwise LGTM.
Thanks @LiorLieberman! /lgtm |
…mental features) (#1611) * add conformance checks for port and scheme (extended features) * fix file name * fix file name * address feedback from comments * fix indent * add experimental path redirect * now added path redirect * address feedback from comments * fix typo
What type of PR is this?
/kind feature
/area conformance
What this PR does / why we need it:
Add tests for extended redirect features (port and scheme) and path experimental feature
Which issue(s) this PR fixes:
Issue #1103
Does this PR introduce a user-facing change?:
NONE