var ( // HTTPConformanceProfile is a ConformanceProfile that covers testing HTTP // related functionality with Gateways. HTTPConformanceProfile = ConformanceProfile{ Name: HTTPConformanceProfileName, CoreFeatures: sets.New( SupportGateway, SupportReferenceGrant, SupportHTTPRoute, ), ExtendedFeatures: HTTPRouteExtendedFeatures, } // TLSConformanceProfile is a ConformanceProfile that covers testing TLS // related functionality with Gateways. TLSConformanceProfile = ConformanceProfile{ Name: TLSConformanceProfileName, CoreFeatures: sets.New( SupportGateway, SupportReferenceGrant, SupportTLSRoute, ), } // MeshConformanceProfile is a ConformanceProfile that covers testing // service mesh related functionality. MeshConformanceProfile = ConformanceProfile{ Name: MeshConformanceProfileName, CoreFeatures: sets.New( SupportMesh, ), } )
AllFeatures contains all the supported features and can be used to run all conformance tests with `all-features` flag.
NOTE: as new feature sets are added they should be inserted into this set.
var AllFeatures = sets.New[SupportedFeature](). Insert(GatewayExtendedFeatures.UnsortedList()...). Insert(ReferenceGrantCoreFeatures.UnsortedList()...). Insert(HTTPRouteCoreFeatures.UnsortedList()...). Insert(HTTPRouteExtendedFeatures.UnsortedList()...). Insert(HTTPRouteExperimentalFeatures.UnsortedList()...). Insert(TLSRouteCoreFeatures.UnsortedList()...). Insert(MeshCoreFeatures.UnsortedList()...)
GatewayCoreFeatures are the features that are required to be conformant with the Gateway resource.
var GatewayCoreFeatures = sets.New( SupportGateway, )
StandardExtendedFeatures are extra generic features that implementations may choose to support as an opt-in.
var GatewayExtendedFeatures = sets.New( SupportGatewayPort8080, SupportGatewayStaticAddresses, ).Insert(GatewayCoreFeatures.UnsortedList()...)
HTTPRouteCoreFeatures includes all SupportedFeatures needed to be conformant with the HTTPRoute resource.
var HTTPRouteCoreFeatures = sets.New( SupportHTTPRoute, )
HTTPRouteExperimentalFeatures includes all the supported experimental features, currently only available in our experimental release channel. Implementations have the flexibility to opt-in for either specific features or the entire set.
var HTTPRouteExperimentalFeatures = sets.New( SupportHTTPRouteDestinationPortMatching, SupportHTTPRouteBackendProtocolH2C, SupportHTTPRouteBackendProtocolWebSocket, )
HTTPRouteExtendedFeatures includes all the supported features for HTTPRoute conformance and can be used to opt-in to run all HTTPRoute tests, including extended features.
var HTTPRouteExtendedFeatures = sets.New( SupportHTTPRouteQueryParamMatching, SupportHTTPRouteMethodMatching, SupportHTTPRouteResponseHeaderModification, SupportHTTPRoutePortRedirect, SupportHTTPRouteSchemeRedirect, SupportHTTPRoutePathRedirect, SupportHTTPRouteHostRewrite, SupportHTTPRoutePathRewrite, SupportHTTPRouteRequestMirror, SupportHTTPRouteRequestMultipleMirrors, SupportHTTPRouteRequestTimeout, SupportHTTPRouteBackendTimeout, )
MeshCoreFeatures includes all the supported features for the service mesh at a Core level of support.
var MeshCoreFeatures = sets.New( SupportMesh, )
ReferenceGrantCoreFeatures includes all SupportedFeatures needed to be conformant with the ReferenceGrant resource.
var ReferenceGrantCoreFeatures = sets.New( SupportReferenceGrant, )
TLSCoreFeatures includes all the supported features for the TLSRoute API at a Core level of support.
var TLSRouteCoreFeatures = sets.New( SupportTLSRoute, )
func ParseConformanceProfiles(p string) sets.Set[ConformanceProfileName]
ParseConformanceProfiles parses flag arguments and converts the string to sets.Set[ConformanceProfileName].
func ParseImplementation(org, project, url, version, contact string) (*confv1a1.Implementation, error)
ParseImplementation parses implementation-specific flag arguments and creates a *confv1a1.Implementation.
func ParseKeyValuePairs(f string) map[string]string
ParseKeyValuePairs parses flag arguments and converts the string to map[string]string containing label key/value pairs.
func ParseSkipTests(t string) []string
ParseSkipTests parses flag arguments and converts the string to []string containing the tests to be skipped.
func ParseSupportedFeatures(f string) sets.Set[SupportedFeature]
ParseSupportedFeatures parses flag arguments and converts the string to sets.Set[suite.SupportedFeature]
ConformanceProfile is a group of features that have a related purpose, e.g. to cover specific protocol support or a specific feature present in Gateway API.
For more details see the relevant GEP: https://gateway-api.sigs.k8s.io/geps/gep-1709/
type ConformanceProfile struct { Name ConformanceProfileName CoreFeatures sets.Set[SupportedFeature] ExtendedFeatures sets.Set[SupportedFeature] }
type ConformanceProfileName string
const ( // HTTPConformanceProfileName indicates the name of the conformance profile // which covers HTTP functionality, such as the HTTPRoute API. HTTPConformanceProfileName ConformanceProfileName = "HTTP" // TLSConformanceProfileName indicates the name of the conformance profile // which covers TLS stream functionality, such as the TLSRoute API. TLSConformanceProfileName ConformanceProfileName = "TLS" // MeshConformanceProfileName indicates the name of the conformance profile // which covers service mesh functionality. MeshConformanceProfileName ConformanceProfileName = "MESH" )
ConformanceTest is used to define each individual conformance test.
type ConformanceTest struct { ShortName string Description string Features []SupportedFeature Manifests []string Slow bool Parallel bool Test func(*testing.T, *ConformanceTestSuite) }
func (test *ConformanceTest) Run(t *testing.T, suite *ConformanceTestSuite)
Run runs an individual tests, applying and cleaning up the required manifests before calling the Test function.
ConformanceTestSuite defines the test suite used to run Gateway API conformance tests.
type ConformanceTestSuite struct { Client client.Client Clientset clientset.Interface RESTClient *rest.RESTClient RestConfig *rest.Config RoundTripper roundtripper.RoundTripper GatewayClassName string ControllerName string Debug bool Cleanup bool BaseManifests string MeshManifests string Applier kubernetes.Applier SupportedFeatures sets.Set[SupportedFeature] TimeoutConfig config.TimeoutConfig SkipTests sets.Set[string] RunTest string FS embed.FS UsableNetworkAddresses []v1beta1.GatewayAddress UnusableNetworkAddresses []v1beta1.GatewayAddress }
func New(s Options) *ConformanceTestSuite
New returns a new ConformanceTestSuite.
func (suite *ConformanceTestSuite) Run(t *testing.T, tests []ConformanceTest)
Run runs the provided set of conformance tests.
func (suite *ConformanceTestSuite) Setup(t *testing.T)
Setup ensures the base resources required for conformance tests are installed in the cluster. It also ensures that all relevant resources are ready.
Options can be used to initialize a ConformanceTestSuite.
type ExperimentalConformanceOptions struct { Options Implementation confv1a1.Implementation ConformanceProfiles sets.Set[ConformanceProfileName] }
ConformanceTestSuite defines the test suite used to run Gateway API conformance tests. This is experimental for now and can be used as an alternative to the ConformanceTestSuite. Once this won't be experimental any longer, the two of them will be merged.
type ExperimentalConformanceTestSuite struct { ConformanceTestSuite // contains filtered or unexported fields }
func NewExperimentalConformanceTestSuite(s ExperimentalConformanceOptions) (*ExperimentalConformanceTestSuite, error)
NewExperimentalConformanceTestSuite is a helper to use for creating a new ExperimentalConformanceTestSuite.
func (suite *ExperimentalConformanceTestSuite) Report() (*confv1a1.ConformanceReport, error)
Report emits a ConformanceReport for the previously completed test run. If no run completed prior to running the report, and error is emitted.
func (suite *ExperimentalConformanceTestSuite) Run(t *testing.T, tests []ConformanceTest) error
Run runs the provided set of conformance tests.
func (suite *ExperimentalConformanceTestSuite) Setup(t *testing.T)
Setup ensures the base resources required for conformance tests are installed in the cluster. It also ensures that all relevant resources are ready.
Options can be used to initialize a ConformanceTestSuite.
type Options struct { Client client.Client Clientset clientset.Interface RestConfig *rest.Config GatewayClassName string Debug bool RoundTripper roundtripper.RoundTripper BaseManifests string MeshManifests string NamespaceLabels map[string]string NamespaceAnnotations map[string]string // CleanupBaseResources indicates whether or not the base test // resources such as Gateways should be cleaned up after the run. CleanupBaseResources bool SupportedFeatures sets.Set[SupportedFeature] ExemptFeatures sets.Set[SupportedFeature] EnableAllSupportedFeatures bool TimeoutConfig config.TimeoutConfig // SkipTests contains all the tests not to be run and can be used to opt out // of specific tests SkipTests []string // RunTest is a single test to run, mostly for development/debugging convenience. RunTest string FS *embed.FS // UsableNetworkAddresses is an optional pool of usable addresses for // Gateways for tests which need to test manual address assignments. UsableNetworkAddresses []v1beta1.GatewayAddress // UnusableNetworkAddresses is an optional pool of unusable addresses for // Gateways for tests which need to test failures with manual Gateway // address assignment. UnusableNetworkAddresses []v1beta1.GatewayAddress }
SupportedFeature allows opting in to additional conformance tests at an individual feature granularity.
type SupportedFeature string
const ( // This option indicates that the Gateway can also use port 8080 SupportGatewayPort8080 SupportedFeature = "GatewayPort8080" // SupportGatewayStaticAddresses option indicates that the Gateway is capable // of allocating pre-determined addresses, rather than dynamically having // addresses allocated for it. SupportGatewayStaticAddresses SupportedFeature = "GatewayStaticAddresses" )
const ( // This option indicates support for HTTPRoute query param matching (extended conformance). SupportHTTPRouteQueryParamMatching SupportedFeature = "HTTPRouteQueryParamMatching" // This option indicates support for HTTPRoute method matching (extended conformance). SupportHTTPRouteMethodMatching SupportedFeature = "HTTPRouteMethodMatching" // This option indicates support for HTTPRoute response header modification (extended conformance). SupportHTTPRouteResponseHeaderModification SupportedFeature = "HTTPRouteResponseHeaderModification" // This option indicates support for HTTPRoute port redirect (extended conformance). SupportHTTPRoutePortRedirect SupportedFeature = "HTTPRoutePortRedirect" // This option indicates support for HTTPRoute scheme redirect (extended conformance). SupportHTTPRouteSchemeRedirect SupportedFeature = "HTTPRouteSchemeRedirect" // This option indicates support for HTTPRoute path redirect (extended conformance). SupportHTTPRoutePathRedirect SupportedFeature = "HTTPRoutePathRedirect" // This option indicates support for HTTPRoute host rewrite (extended conformance) SupportHTTPRouteHostRewrite SupportedFeature = "HTTPRouteHostRewrite" // This option indicates support for HTTPRoute path rewrite (extended conformance) SupportHTTPRoutePathRewrite SupportedFeature = "HTTPRoutePathRewrite" // This option indicates support for HTTPRoute request mirror (extended conformance). SupportHTTPRouteRequestMirror SupportedFeature = "HTTPRouteRequestMirror" // This option indicates support for multiple RequestMirror filters within the same HTTPRoute rule (extended conformance). SupportHTTPRouteRequestMultipleMirrors SupportedFeature = "HTTPRouteRequestMultipleMirrors" // This option indicates support for HTTPRoute request timeouts (extended conformance). SupportHTTPRouteRequestTimeout SupportedFeature = "HTTPRouteRequestTimeout" // This option indicates support for HTTPRoute backendRequest timeouts (extended conformance). SupportHTTPRouteBackendTimeout SupportedFeature = "HTTPRouteBackendTimeout" // This option indicates support for HTTPRoute with a backendref with an appProtocol 'kubernetes.io/h2c' SupportHTTPRouteBackendProtocolH2C SupportedFeature = "HTTPRouteBackendProtocolH2C" // This option indicates support for HTTPRoute with a backendref with an appProtoocol 'kubernetes.io/ws' SupportHTTPRouteBackendProtocolWebSocket SupportedFeature = "HTTPRouteBackendProtocolWebSocket" )
const ( // This option indicates support for Gateway. // Opting out of this is allowed only for GAMMA-only implementations SupportGateway SupportedFeature = "Gateway" )
const ( // This option indicates support for HTTPRoute SupportHTTPRoute SupportedFeature = "HTTPRoute" )
const ( // This option indicates support for Destination Port matching. SupportHTTPRouteDestinationPortMatching SupportedFeature = "HTTPRouteDestinationPortMatching" )
const ( // This option indicates general support for service mesh SupportMesh SupportedFeature = "Mesh" )
const ( // This option indicates support for ReferenceGrant. SupportReferenceGrant SupportedFeature = "ReferenceGrant" )
const ( // This option indicates support for TLSRoute SupportTLSRoute SupportedFeature = "TLSRoute" )