@@ -74,9 +74,29 @@ const (
74
74
75
75
// StandardCoreFeatures are the features that are required to be conformant with
76
76
// the Core API features that are part of the Standard release channel.
77
- var StandardCoreFeatures = map [SupportedFeature ]bool {
78
- SupportReferenceGrant : true ,
79
- }
77
+ var StandardCoreFeatures = sets .New (
78
+ SupportReferenceGrant ,
79
+ )
80
+
81
+ // AllFeatures contains all the supported features and can be used to run all
82
+ // conformance tests with `all-features` flag.
83
+ //
84
+ // Note that the AllFeatures must in sync with defined features when the
85
+ // feature constants change.
86
+ var AllFeatures = sets .New (
87
+ SupportReferenceGrant ,
88
+ SupportTLSRoute ,
89
+ SupportHTTPRouteQueryParamMatching ,
90
+ SupportHTTPRouteMethodMatching ,
91
+ SupportHTTPResponseHeaderModification ,
92
+ SupportRouteDestinationPortMatching ,
93
+ SupportGatewayClassObservedGenerationBump ,
94
+ SupportHTTPRoutePortRedirect ,
95
+ SupportHTTPRouteSchemeRedirect ,
96
+ SupportHTTPRoutePathRedirect ,
97
+ SupportHTTPRouteHostRewrite ,
98
+ SupportHTTPRoutePathRewrite ,
99
+ )
80
100
81
101
// ConformanceTestSuite defines the test suite used to run Gateway API
82
102
// conformance tests.
@@ -89,7 +109,7 @@ type ConformanceTestSuite struct {
89
109
Cleanup bool
90
110
BaseManifests string
91
111
Applier kubernetes.Applier
92
- SupportedFeatures map [SupportedFeature ]bool
112
+ SupportedFeatures sets. Set [SupportedFeature ]
93
113
TimeoutConfig config.TimeoutConfig
94
114
SkipTests sets.Set [string ]
95
115
}
@@ -112,9 +132,10 @@ type Options struct {
112
132
113
133
// CleanupBaseResources indicates whether or not the base test
114
134
// resources such as Gateways should be cleaned up after the run.
115
- CleanupBaseResources bool
116
- SupportedFeatures map [SupportedFeature ]bool
117
- TimeoutConfig config.TimeoutConfig
135
+ CleanupBaseResources bool
136
+ SupportedFeatures sets.Set [SupportedFeature ]
137
+ EnableAllSupportedFeatures bool
138
+ TimeoutConfig config.TimeoutConfig
118
139
// SkipTests contains all the tests not to be run and can be used to opt out
119
140
// of specific tests
120
141
SkipTests []string
@@ -129,13 +150,13 @@ func New(s Options) *ConformanceTestSuite {
129
150
roundTripper = & roundtripper.DefaultRoundTripper {Debug : s .Debug , TimeoutConfig : s .TimeoutConfig }
130
151
}
131
152
132
- if s .SupportedFeatures == nil {
153
+ if s .EnableAllSupportedFeatures == true {
154
+ s .SupportedFeatures = AllFeatures
155
+ } else if s .SupportedFeatures == nil {
133
156
s .SupportedFeatures = StandardCoreFeatures
134
157
} else {
135
- for feature , val := range StandardCoreFeatures {
136
- if _ , ok := s .SupportedFeatures [feature ]; ! ok {
137
- s .SupportedFeatures [feature ] = val
138
- }
158
+ for feature := range StandardCoreFeatures {
159
+ s .SupportedFeatures .Insert (feature )
139
160
}
140
161
}
141
162
@@ -222,7 +243,7 @@ func (test *ConformanceTest) Run(t *testing.T, suite *ConformanceTestSuite) {
222
243
// Check that all features exercised by the test have been opted into by
223
244
// the suite.
224
245
for _ , feature := range test .Features {
225
- if supported , ok := suite .SupportedFeatures [ feature ]; ! ok || ! supported {
246
+ if ! suite .SupportedFeatures . Has ( feature ) {
226
247
t .Skipf ("Skipping %s: suite does not support %s" , test .ShortName , feature )
227
248
}
228
249
}
0 commit comments