suite

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 17 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(TLSRouteCoreFeatures.UnsortedList()...).
	Insert(MeshCoreFeatures.UnsortedList()...).
	Insert(ExperimentalFeatures.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 ExperimentalFeatures = sets.New(
	SupportRouteDestinationPortMatching,
)

ExperimentalFeatures are extra generic features that are currently only available in our experimental release channel.

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,
).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,
)

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

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]
	FS                embed.FS
}

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

	FS *embed.FS
}

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 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).
	SupportHTTPResponseHeaderModification SupportedFeature = "HTTPResponseHeaderModification"

	// 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 (experimental conformance).
	SupportHTTPRoutePathRedirect SupportedFeature = "HTTPRoutePathRedirect"

	// This option indicates support for HTTPRoute host rewrite (experimental conformance)
	SupportHTTPRouteHostRewrite SupportedFeature = "HTTPRouteHostRewrite"

	// This option indicates support for HTTPRoute path rewrite (experimental 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"
)
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 that the Gateway can also use port 8080
	SupportGatewayPort8080 SupportedFeature = "GatewayPort8080"
)
const (
	// This option indicates support for HTTPRoute
	SupportHTTPRoute SupportedFeature = "HTTPRoute"
)
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 Destination Port matching.
	SupportRouteDestinationPortMatching SupportedFeature = "RouteDestinationPortMatching"
)
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