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

Add flags for SupportedFeatures and ExemptFeatures in conformance tests. #1394

Merged

Conversation

gyohuangxin
Copy link
Member

@gyohuangxin gyohuangxin commented Sep 20, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR add flags for SupportedFeatures and ExemptFeatures in conformance tests.

Examples:

// conformance tests with supported features 
go test ./conformance --gateway-class nginx -v -supported-features ReferenceGrant
go test ./conformance --gateway-class nginx -v -supported-features ReferenceGrant,HTTPRouteQueryParamMatching,HTTPRouteMethodMatchig

// conformance tests with exempt features
go test ./conformance --gateway-class nginx -v -exempt-features ReferenceGrant

Which issue(s) this PR fixes:

Fixes #1391

Does this PR introduce a user-facing change?:

1. Add flags for SupportedFeatures and ExemptFeatures in conformance tests.
2. Remove suite.SupportReferenceGrant as the default value of SupportedFeatures.
3. Replace `Features:    []suite.SupportedFeature{suite.SupportReferenceGrant}` from Features list to `Exemptions:  []suite.ExemptFeature{suite.ExemptReferenceGrant}` on all tests.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 20, 2022
@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/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 20, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @gyohuangxin. 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.

cSuite := suite.New(suite.Options{
Client: client,
GatewayClassName: *flags.GatewayClassName,
Debug: *flags.ShowDebug,
CleanupBaseResources: *flags.CleanupBaseResources,
SupportedFeatures: []suite.SupportedFeature{
suite.SupportReferenceGrant,
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the original intent of having this specific feature hardcoded was to include ReferenceGrant in the default set of conformance tests - I'm not sure if we should try to keep a "default supported features" list somehow (feels awkward), or instead just change conformance tests currently enabled with the flag to instead switch to an ExemptFeature flag to opt-out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we can make a "default supported features" which runs all the conformance tests, and we can change enabled tests with SupportedFeatures flag or just opt-out tests with ExemptFeatures flag. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could just remove the suite.SupportReferenceGrant constant, and remove it from the Features list on all conformance tests that currently expect it to be set.

This keeps those tests included by default, still allows using the ExemptReferenceGrant flag to opt-out, avoids any complexity of an extra "default" list, and feels okay given that we're intending to promote ReferenceGrant to v1beta1 in the upcoming v0.6.0 Gateway API release.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mikemorris Thanks for your reply, I can understand it basically. What to do are:

  1. Remove suite.SupportReferenceGrant as the default value of SupportedFeatures
  2. Remove suite.SupportReferenceGrant from Features list on all tests, such as https://github.com/kubernetes-sigs/gateway-api/blob/main/conformance/tests/gateway-secret-invalid-reference-grant.go#L37. Then replace it to Exemptions: []suite.ExemptFeature{ suite.ExemptReferenceGrant, },, so that --exempt-features ExemptReferenceGrant flag can be set to opt-out.

Can I confirm it is correct?

Copy link
Contributor

@mikemorris mikemorris Sep 26, 2022

Choose a reason for hiding this comment

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

Yes, that should be correct @gyohuangxin!

I think we can then do:
3. Remove the constant at

// This option indicates support for the ReferenceGrant object.
SupportReferenceGrant SupportedFeature = "ReferenceGrant"

In upcoming Gateway API v0.6.0, all implementations should assume ReferenceGrant is supported unless explicitly setting ExemptReferenceGrant.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mikemorris Thanks! I've updated the code and the "user-facing change" section per your comments, please review again.

@mikemorris
Copy link
Contributor

/ok-to-test

@gyohuangxin Could you add a changelog entry in the "user-facing change" section?

@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 Sep 20, 2022
@gyohuangxin
Copy link
Member Author

/ok-to-test

@gyohuangxin Could you add a changelog entry in the "user-facing change" section?

Updated the "user-facing change" section.

@gyohuangxin
Copy link
Member Author

@aryan9600 @mikemorris Any more comments?

Signed-off-by: Huang Xin <xin1.huang@intel.com>
…eatures and remove suite.SupportReferenceGrant from Features list on all tests.

Signed-off-by: Huang Xin <xin1.huang@intel.com>
@gyohuangxin gyohuangxin requested review from mikemorris and removed request for robscott September 28, 2022 15:35
@mikemorris
Copy link
Contributor

mikemorris commented Sep 29, 2022

/assign @mikemorris

@mikemorris
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 29, 2022
@mikemorris
Copy link
Contributor

/assign @shaneutt

@gyohuangxin
Copy link
Member Author

@shaneutt Can you help review it? Thanks.

@gyohuangxin
Copy link
Member Author

@shaneutt Cloud you please have a look on that?

@robscott
Copy link
Member

robscott commented Oct 4, 2022

Thanks @gyohuangxin!

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gyohuangxin, robscott

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 Oct 4, 2022
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. kind/feature Categorizes issue or PR as related to a new feature. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add flags for SupportedFeature and ExemptFeature in conformance tests
6 participants