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

added conformance checks for port, scheme and path (extended + experimental features) #1611

Merged

Conversation

LiorLieberman
Copy link
Member

@LiorLieberman LiorLieberman commented Dec 18, 2022

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

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 18, 2022
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 18, 2022
@LiorLieberman LiorLieberman marked this pull request as ready for review December 18, 2022 22:50
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 18, 2022
@LiorLieberman
Copy link
Member Author

@robscott

Comment on lines 293 to 303
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"
}
Copy link
Member Author

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

Copy link
Member

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 🤔

Copy link
Member Author

@LiorLieberman LiorLieberman Dec 20, 2022

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.

Copy link
Member Author

@LiorLieberman LiorLieberman Dec 20, 2022

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
}

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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

@robscott
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 19, 2022
@LiorLieberman
Copy link
Member Author

/assign @shaneutt

Copy link
Member

@shaneutt shaneutt left a 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/tests/httproute-redirect-port.go Show resolved Hide resolved
conformance/tests/httproute-redirect-port.go Outdated Show resolved Hide resolved
conformance/tests/httproute-redirect-port.go Outdated Show resolved Hide resolved
conformance/tests/httproute-redirect-port.go Show resolved Hide resolved
conformance/tests/httproute-redirect-scheme.go Outdated Show resolved Hide resolved
conformance/tests/httproute-redirect-scheme.go Outdated Show resolved Hide resolved
conformance/utils/http/http.go Outdated Show resolved Hide resolved
Comment on lines 293 to 303
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"
}
Copy link
Member

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 🤔

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 20, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 20, 2022
@LiorLieberman LiorLieberman requested review from shaneutt and removed request for youngnick December 20, 2022 15:48
@LiorLieberman
Copy link
Member Author

LiorLieberman commented Dec 20, 2022

@shaneutt Thanks very much for the feedback, I did miss some important things.
PTAL
(will rebase once we address all the comments)

Copy link
Member

@shaneutt shaneutt left a 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.

@k8s-ci-robot
Copy link
Contributor

[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 /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 Dec 20, 2022
Copy link
Member

@robscott robscott left a 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.

conformance/tests/httproute-redirect-port.go Show resolved Hide resolved
conformance/tests/httproute-redirect-port.go Show resolved Hide resolved
conformance/tests/httproute-redirect-port.yaml Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 23, 2022
@LiorLieberman LiorLieberman changed the title added conformance checks for port and scheme (extended features) added conformance checks for port, scheme and path (extended + experimental features) Dec 23, 2022
@LiorLieberman
Copy link
Member Author

@shaneutt @robscott

I have made a small refactor

PTAL

Copy link
Member

@robscott robscott left a 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.

conformance/utils/http/http.go Show resolved Hide resolved
conformance/utils/suite/suite.go Outdated Show resolved Hide resolved
conformance/tests/httproute-redirect-port.yaml Outdated Show resolved Hide resolved
@robscott robscott added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Dec 29, 2022
@robscott
Copy link
Member

Thanks @LiorLieberman!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 29, 2022
@k8s-ci-robot k8s-ci-robot merged commit d037303 into kubernetes-sigs:main Dec 29, 2022
@shaneutt shaneutt added this to the v0.6.1 milestone Feb 7, 2023
shaneutt pushed a commit that referenced this pull request Feb 7, 2023
…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
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants