-
Notifications
You must be signed in to change notification settings - Fork 491
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 all-features
flag to add ability to enable all supported feature conformance tests.
#1642
Add all-features
flag to add ability to enable all supported feature conformance tests.
#1642
Conversation
conformance/utils/flags/flags.go
Outdated
CleanupBaseResources = flag.Bool("cleanup-base-resources", true, "Whether to cleanup base test resources after the run") | ||
SupportedFeatures = flag.String("supported-features", "", "Supported features included in conformance tests suites") | ||
ExemptFeatures = flag.String("exempt-features", "", "Exempt Features excluded from conformance tests suites") | ||
EnableAllSupportedFeatures = flag.Bool("all-features", false, "Whether to enable all supported feature conformance tests") |
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.
flag name lgtm !
conformance/utils/suite/suite.go
Outdated
@@ -77,6 +77,23 @@ var StandardCoreFeatures = map[SupportedFeature]bool{ | |||
SupportReferenceGrant: true, | |||
} | |||
|
|||
// AllFeatures contains all the supported features and can be used to run all | |||
// conformance tests with `all-features` flag. | |||
var AllFeatures = map[SupportedFeature]bool{ |
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.
is there any way a contributor defines the suite name once ? I fear the contributor will add it the constant w/o adding it to this map, and the burden to ensure its in sync will fall on the maintainer/ code reviewer
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.
Yes, you are right, developers need to modify two places after the constant changes. But I can't find a simple way to define the suite name once in this codebase. Or I can add a comment to notice developer/code reviewer to ensure they are in sync?
@robscott Can you help with some advice?
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 can't think of a better solution rn, can you add a comment to ensure they are in sync, TIA !
@robscott Could you review it? Thanks |
conformance/utils/suite/suite.go
Outdated
@@ -77,6 +77,23 @@ var StandardCoreFeatures = map[SupportedFeature]bool{ | |||
SupportReferenceGrant: true, | |||
} | |||
|
|||
// AllFeatures contains all the supported features and can be used to run all | |||
// conformance tests with `all-features` flag. | |||
var AllFeatures = map[SupportedFeature]bool{ |
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.
Perhaps we should consider using a set for this instead of a map?
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.
IMO, there is no native set structure in golang, do you mean the map[SupportedFeature]struct{}
? Also we should pass AllFeatures
to suite's SupportedFeatures
, so we should make them the same type.
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.
Sets are available in apimachinery:
https://github.com/kubernetes/apimachinery/tree/master/pkg/util/sets
e.g.:
import "k8s.io/apimachinery/pkg/utils/sets"
var AllFeatures = sets.NewString(
SupportReferenceGrant,
SupportTLSRoute,
SupportHTTPRouteQueryParamMatching,
SupportHTTPRouteMethodMatching,
SupportHTTPResponseHeaderModification,
SupportRouteDestinationPortMatching,
SupportGatewayClassObservedGenerationBump,
SupportHTTPRoutePortRedirect,
SupportHTTPRouteSchemeRedirect,
SupportHTTPRoutePathRedirect,
SupportHTTPRouteHostRewrite,
SupportHTTPRoutePathRewrite,
)
if AllFeatures.Has(SupportReferenceGrant) {
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.
@shaneutt Thank you for providing this example, it does provide an easy way to use set.
However, var AllFeatures = map[SupportedFeature]bool
is also equivalent to a set, and I think it's better to keep AllFeatures
declared in the same way as StandardCoreFeatures
unless we also change the declaration method of StandardCoreFeatures
. What do you think? Please correct me if I was wrong.
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.
Yes the implementation ultimately uses a map, so the benefit here is for the developers which I think is a fair thing to trade for, however I don't consider this suggestion a blocker I'll let others weigh in.
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.
Understood, if others also want the benefit, I can implement it.
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.
Now that the k8s sets util supports generics, I think it would be best to move both this and AllFeatures over to use that approach.
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.
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 @gyohuangxin! Agree with moving to k8s sets util, but otherwise this LGTM.
conformance/utils/suite/suite.go
Outdated
@@ -77,6 +77,23 @@ var StandardCoreFeatures = map[SupportedFeature]bool{ | |||
SupportReferenceGrant: true, | |||
} | |||
|
|||
// AllFeatures contains all the supported features and can be used to run all | |||
// conformance tests with `all-features` flag. | |||
var AllFeatures = map[SupportedFeature]bool{ |
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.
Now that the k8s sets util supports generics, I think it would be best to move both this and AllFeatures over to use that approach.
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.
lgtm, thanks for adding this !
…e conformance tests. Signed-off-by: Huang Xin <[email protected]>
Signed-off-by: Huang Xin <[email protected]>
Signed-off-by: Huang Xin <[email protected]>
…features when feature constants change. Signed-off-by: Huang Xin <[email protected]>
173f08e
to
2cc158b
Compare
Signed-off-by: Huang Xin <[email protected]>
d4a4440
to
b85174a
Compare
Signed-off-by: Huang Xin <[email protected]>
Signed-off-by: Huang Xin <[email protected]>
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.
Would like @robscott to give the final LGTM since he's been reviewing this too, but does LGTM.
Signed-off-by: Huang Xin <[email protected]>
@robscott Can you review it? |
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 @gyohuangxin!
Co-authored-by: Rob Scott <[email protected]>
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: arkodg, gyohuangxin, 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 |
Add `all-features` flag to add ability to enable all supported feature conformance tests.
What type of PR is this?
/kind feature
What this PR does / why we need it:
It adds
all-features
flag to add ability to enable all supported feature conformance tests. For example:Which issue(s) this PR fixes:
Fixes #1638
Does this PR introduce a user-facing change?: