Skip to content

Commit 2a83610

Browse files
committed
Add all-features flag to add ability to enable all supported feature conformance tests.
Signed-off-by: Huang Xin <[email protected]>
1 parent 5032f56 commit 2a83610

File tree

3 files changed

+43
-24
lines changed

3 files changed

+43
-24
lines changed

conformance/conformance_test.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ func TestConformance(t *testing.T) {
5454
*flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug, *flags.SupportedFeatures, *flags.ExemptFeatures)
5555

5656
cSuite := suite.New(suite.Options{
57-
Client: client,
58-
GatewayClassName: *flags.GatewayClassName,
59-
Debug: *flags.ShowDebug,
60-
CleanupBaseResources: *flags.CleanupBaseResources,
61-
SupportedFeatures: supportedFeatures,
57+
Client: client,
58+
GatewayClassName: *flags.GatewayClassName,
59+
Debug: *flags.ShowDebug,
60+
CleanupBaseResources: *flags.CleanupBaseResources,
61+
SupportedFeatures: supportedFeatures,
62+
EnableAllSupportedFeatures: *flags.EnableAllSupportedFeatures,
6263
})
6364
cSuite.Setup(t)
6465
cSuite.Run(t, tests.ConformanceTests)

conformance/utils/flags/flags.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ import (
2424
)
2525

2626
var (
27-
GatewayClassName = flag.String("gateway-class", "gateway-conformance", "Name of GatewayClass to use for tests")
28-
ShowDebug = flag.Bool("debug", false, "Whether to print debug logs")
29-
CleanupBaseResources = flag.Bool("cleanup-base-resources", true, "Whether to cleanup base test resources after the run")
30-
SupportedFeatures = flag.String("supported-features", "", "Supported features included in conformance tests suites")
31-
ExemptFeatures = flag.String("exempt-features", "", "Exempt Features excluded from conformance tests suites")
27+
GatewayClassName = flag.String("gateway-class", "gateway-conformance", "Name of GatewayClass to use for tests")
28+
ShowDebug = flag.Bool("debug", false, "Whether to print debug logs")
29+
CleanupBaseResources = flag.Bool("cleanup-base-resources", true, "Whether to cleanup base test resources after the run")
30+
SupportedFeatures = flag.String("supported-features", "", "Supported features included in conformance tests suites")
31+
ExemptFeatures = flag.String("exempt-features", "", "Exempt Features excluded from conformance tests suites")
32+
EnableAllSupportedFeatures = flag.Bool("all-features", false, "Whether to enable all supported feature conformance tests")
3233
)

conformance/utils/suite/suite.go

+31-14
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ var StandardCoreFeatures = map[SupportedFeature]bool{
7878
SupportReferenceGrant: true,
7979
}
8080

81+
// AllFeatures contains all the supported features and can be used to run all
82+
// conformance tests with `all-features` flag.
83+
var AllFeatures = map[SupportedFeature]bool{
84+
SupportReferenceGrant: true,
85+
SupportTLSRoute: true,
86+
SupportHTTPRouteQueryParamMatching: true,
87+
SupportHTTPRouteMethodMatching: true,
88+
SupportHTTPResponseHeaderModification: true,
89+
SupportRouteDestinationPortMatching: true,
90+
SupportGatewayClassObservedGenerationBump: true,
91+
SupportHTTPRoutePortRedirect: true,
92+
SupportHTTPRouteSchemeRedirect: true,
93+
SupportHTTPRoutePathRedirect: true,
94+
SupportHTTPRouteHostRewrite: true,
95+
SupportHTTPRoutePathRewrite: true,
96+
}
97+
8198
// ConformanceTestSuite defines the test suite used to run Gateway API
8299
// conformance tests.
83100
type ConformanceTestSuite struct {
@@ -96,28 +113,26 @@ type ConformanceTestSuite struct {
96113

97114
// Options can be used to initialize a ConformanceTestSuite.
98115
type Options struct {
99-
Client client.Client
100-
GatewayClassName string
101-
Debug bool
102-
RoundTripper roundtripper.RoundTripper
103-
BaseManifests string
104-
NamespaceLabels map[string]string
116+
Client client.Client
117+
GatewayClassName string
118+
Debug bool
119+
RoundTripper roundtripper.RoundTripper
120+
BaseManifests string
121+
NamespaceLabels map[string]string
105122
// ValidUniqueListenerPorts maps each listener port of each Gateway in the
106123
// manifests to a valid, unique port. There must be as many
107124
// ValidUniqueListenerPorts as there are listeners in the set of manifests.
108125
// For example, given two Gateways, each with 2 listeners, there should be
109126
// four ValidUniqueListenerPorts.
110127
// If empty or nil, ports are not modified.
111-
ValidUniqueListenerPorts []v1beta1.PortNumber
128+
ValidUniqueListenerPorts []v1beta1.PortNumber
112129

113130
// CleanupBaseResources indicates whether or not the base test
114131
// resources such as Gateways should be cleaned up after the run.
115-
CleanupBaseResources bool
116-
SupportedFeatures map[SupportedFeature]bool
117-
TimeoutConfig config.TimeoutConfig
118-
// SkipTests contains all the tests not to be run and can be used to opt out
119-
// of specific tests
120-
SkipTests []string
132+
CleanupBaseResources bool
133+
SupportedFeatures map[SupportedFeature]bool
134+
EnableAllSupportedFeatures bool
135+
TimeoutConfig config.TimeoutConfig
121136
}
122137

123138
// New returns a new ConformanceTestSuite.
@@ -129,7 +144,9 @@ func New(s Options) *ConformanceTestSuite {
129144
roundTripper = &roundtripper.DefaultRoundTripper{Debug: s.Debug, TimeoutConfig: s.TimeoutConfig}
130145
}
131146

132-
if s.SupportedFeatures == nil {
147+
if s.EnableAllSupportedFeatures == true {
148+
s.SupportedFeatures = AllFeatures
149+
} else if s.SupportedFeatures == nil {
133150
s.SupportedFeatures = StandardCoreFeatures
134151
} else {
135152
for feature, val := range StandardCoreFeatures {

0 commit comments

Comments
 (0)