Skip to content

conformance test: CORS #3739

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

zhaohuabing
Copy link
Contributor

What type of PR is this?
/kind test
/area conformance-test

What this PR does / why we need it:
This PR adds conformance tests for HTTPCORSFilter.

Which issue(s) this PR fixes:

Related #3649

Does this PR introduce a user-facing change?:

None

@k8s-ci-robot
Copy link
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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.

@k8s-ci-robot k8s-ci-robot added kind/test do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. area/conformance-test Issues or PRs related to Conformance tests. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 9, 2025
@zhaohuabing zhaohuabing marked this pull request as draft April 9, 2025 02:25
@k8s-ci-robot
Copy link
Contributor

Hi @zhaohuabing. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Apr 9, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zhaohuabing
Once this PR has been reviewed and has the lgtm label, please assign shaneutt for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zhaohuabing zhaohuabing changed the title test: cors conformance test: CORS Apr 9, 2025
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing marked this pull request as ready for review April 24, 2025 12:00
@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 Apr 24, 2025
@k8s-ci-robot k8s-ci-robot requested a review from youngnick April 24, 2025 12:00
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing
Copy link
Contributor Author

Hi @mikemorris @sunjayBhatia @youngnick Is there anything I can do to help the review? This is the first time creating a conformance test PR, so there is a good chance I may have missed something that's blocking the review. Please feel free to let me know if there's anything I can address. Thanks!

cc @arkodg

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing requested a review from snorwin May 14, 2025 08:00
Headers: map[string]string{
"Origin": "https://www.bar.com",
"access-control-request-method": "GET",
"access-control-request-headers": "x-header-1, x-header-2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the specification (https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1/httproute_types.go#L1386), headers (and also methods) are separated by "," instead of ", ".

Copy link
Contributor Author

@zhaohuabing zhaohuabing May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this against Envoy Gateway, and the methods in the access-control-request-headers header are separated by ", ". Also, the example in https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Methods contains whitespaces.

Access-Control-Allow-Methods: PUT, DELETE

Copy link
Member

@snorwin snorwin May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right. The test should accommodate both formats.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snorwin I added an option to ignore the whitespace in the header value.

@snorwin
Copy link
Member

snorwin commented May 15, 2025

@zhaohuabing I verified the new CORS tests against our implementation and identified a difference in how the access-control-request-headers is mapped. See the comment here: #3739 (comment).

Just a heads-up: depending on the outcome of #3648, the tests might need to be adapted or extended accordingly.

zhaohuabing and others added 2 commits May 15, 2025 17:33
Co-authored-by: Norwin Schnyder <norwin.schnyder+github@gmail.com>
Co-authored-by: Norwin Schnyder <norwin.schnyder+github@gmail.com>
@zhaohuabing zhaohuabing force-pushed the cors-test branch 2 times, most recently from e6c17a3 to d0e2f9a Compare May 15, 2025 11:01
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@snorwin
Copy link
Member

snorwin commented May 15, 2025

@zhaohuabing lgtm, however, since I’m not part of the approvers, I’m unable to formally approve it.

@zhaohuabing
Copy link
Contributor Author

zhaohuabing commented May 21, 2025

Gentle ping @youngnick @sunjayBhatia @mikemorris — whenever you get a chance, would love your thoughts on this.

@snorwin
Copy link
Member

snorwin commented May 29, 2025

/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 May 29, 2025
@zhaohuabing
Copy link
Contributor Author

/test pull-gateway-api-verify

Co-authored-by: Norwin Schnyder <norwin.schnyder+github@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/conformance-test Issues or PRs related to Conformance tests. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/test ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants