suite

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
		),
	}
)
View Source
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()...)

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.

View Source
var GatewayCoreFeatures = sets.New(
	SupportGateway,
)

GatewayCoreFeatures are the features that are required to be conformant with the Gateway resource.

View Source
var GatewayExtendedFeatures = sets.New(
	SupportGatewayPort8080,
	SupportGatewayStaticAddresses,
).Insert(GatewayCoreFeatures.UnsortedList()...)

StandardExtendedFeatures are extra generic features that implementations may choose to support as an opt-in.

View Source
var HTTPRouteCoreFeatures = sets.New(
	SupportHTTPRoute,
)

HTTPRouteCoreFeatures includes all SupportedFeatures needed to be conformant with the HTTPRoute resource.

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.

HTTPRouteExtendedFeatures includes all the supported features for HTTPRoute conformance and can be used to opt-in to run all HTTPRoute tests, including extended features.

View Source
var MeshCoreFeatures = sets.New(
	SupportMesh,
)

MeshCoreFeatures includes all the supported features for the service mesh at a Core level of support.

View Source
var ReferenceGrantCoreFeatures = sets.New(
	SupportReferenceGrant,
)

ReferenceGrantCoreFeatures includes all SupportedFeatures needed to be conformant with the ReferenceGrant resource.

View Source
var TLSRouteCoreFeatures = sets.New(
	SupportTLSRoute,
)

TLSCoreFeatures includes all the supported features for the TLSRoute API at a Core level of support.

Functions

func ParseConformanceProfiles added in v0.8.0

func ParseConformanceProfiles(p string) sets.Set[ConformanceProfileName]

ParseConformanceProfiles parses flag arguments and converts the string to sets.Set[ConformanceProfileName].

func ParseImplementation added in v0.8.0

func ParseImplementation(org, project, url, version, contact string) (*confv1a1.Implementation, error)

ParseImplementation parses implementation-specific flag arguments and creates a *confv1a1.Implementation.

func ParseKeyValuePairs added in v0.8.0

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 added in v0.8.0

func ParseSkipTests(t string) []string

ParseSkipTests parses flag arguments and converts the string to []string containing the tests to be skipped.

func ParseSupportedFeatures added in v0.8.0

func ParseSupportedFeatures(f string) sets.Set[SupportedFeature]

ParseSupportedFeatures parses flag arguments and converts the string to sets.Set[suite.SupportedFeature]

Types

type ConformanceProfile added in v0.8.0

type ConformanceProfile struct {
	Name             ConformanceProfileName
	CoreFeatures     sets.Set[SupportedFeature]
	ExtendedFeatures sets.Set[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 ConformanceProfileName added in v0.8.0

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"
)

type ConformanceTest

type ConformanceTest struct {
	ShortName   string
	Description string
	Features    []SupportedFeature
	Manifests   []string
	Slow        bool
	Parallel    bool
	Test        func(*testing.T, *ConformanceTestSuite)
}

ConformanceTest is used to define each individual conformance test.

func (*ConformanceTest) Run

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.

type ConformanceTestSuite

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
}

ConformanceTestSuite defines the test suite used to run Gateway API conformance tests.

func New

New returns a new ConformanceTestSuite.

func (*ConformanceTestSuite) Run

func (suite *ConformanceTestSuite) Run(t *testing.T, tests []ConformanceTest)

Run runs the provided set of conformance tests.

func (*ConformanceTestSuite) Setup

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.

type ExperimentalConformanceOptions added in v0.8.0

type ExperimentalConformanceOptions struct {
	Options

	Implementation      confv1a1.Implementation
	ConformanceProfiles sets.Set[ConformanceProfileName]
}

Options can be used to initialize a ConformanceTestSuite.

type ExperimentalConformanceTestSuite added in v0.8.0

type ExperimentalConformanceTestSuite struct {
	ConformanceTestSuite
	// contains filtered or unexported fields
}

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.

func NewExperimentalConformanceTestSuite added in v0.8.0

func NewExperimentalConformanceTestSuite(s ExperimentalConformanceOptions) (*ExperimentalConformanceTestSuite, error)

NewExperimentalConformanceTestSuite is a helper to use for creating a new ExperimentalConformanceTestSuite.

func (*ExperimentalConformanceTestSuite) Report added in v0.8.0

Report emits a ConformanceReport for the previously completed test run. If no run completed prior to running the report, and error is emitted.

func (*ExperimentalConformanceTestSuite) Run added in v0.8.0

Run runs the provided set of conformance tests.

func (*ExperimentalConformanceTestSuite) Setup added in v0.8.0

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.

type Options

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
}

Options can be used to initialize a ConformanceTestSuite.

type SupportedFeature

type SupportedFeature string

SupportedFeature allows opting in to additional conformance tests at an individual feature granularity.

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL