Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 redirect tests for core redirect features #1556
added redirect tests for core redirect features #1556
Changes from 2 commits
d0b27d9
0ccda9d
c1c4952
be24a2a
cf34a2f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Even though we only allow 301 and 302, I'd make this logic more future-proof to include the full set of redirect codes. There's a chance we'll add more in the future, but even if not, it will be more helpful to show a more useful error message than if we didn't capture the redirect info.
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.
Can you elaborate? my thought was to put it in a function so we will have a one central place for adding more codes in the future. I think now we want to fail conformance if someone returns something other than 301/302 because we do not support it, correct?
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.
Let's say an implementation is actually returning a 307 or 308. With the current code, we wouldn't actually populate the rest of the redirect info for the rest of the test logic, so it would just look like everything failed instead of just having the wrong status code set.
I think the
IsRedirect
function is primarily a check on if we should populate the new redirect struct. The roundtripper itself should not care about what is conformant or not, just in making sure it populates as much information as possible so the tests can determine if the response was conformant.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.
Thats a good point, however we do check for wrong status code
gateway-api/conformance/utils/http/http.go
Lines 194 to 196 in c1c4952
I agree the roundtripper should not care about conformance, would you prefer to construct the redirect struct always? Whats the value you think it'll give us? it wont change the behavior of the above lines - we will have a failure with a wrong status code still.
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 think we should always construct the redirect struct for any 3xx status code. Although the test will still fail, it will likely provide more useful information to the person debugging the test. Instead of simply knowing the code is wrong, they'll also be able to see if the location they are redirecting to has any issues.
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.
Makes sense, I have added all the codes but if you prefer I will do something like this instead let me know