suite

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 26 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GatewayHTTPConformanceProfile is a ConformanceProfile that covers testing HTTP
	// related functionality with Gateways.
	GatewayHTTPConformanceProfile = ConformanceProfile{
		Name: GatewayHTTPConformanceProfileName,
		CoreFeatures: sets.New(
			features.SupportGateway,
			features.SupportReferenceGrant,
			features.SupportHTTPRoute,
		),
		ExtendedFeatures: sets.New[features.SupportedFeature]().
			Insert(features.GatewayExtendedFeatures.UnsortedList()...).
			Insert(features.HTTPRouteExtendedFeatures.UnsortedList()...),
	}

	// GatewayTLSConformanceProfile is a ConformanceProfile that covers testing TLS
	// related functionality with Gateways.
	GatewayTLSConformanceProfile = ConformanceProfile{
		Name: GatewayTLSConformanceProfileName,
		CoreFeatures: sets.New(
			features.SupportGateway,
			features.SupportReferenceGrant,
			features.SupportTLSRoute,
		),
		ExtendedFeatures: features.GatewayExtendedFeatures,
	}

	// GatewayGRPCConformanceProfile is a ConformanceProfile that covers testing GRPC
	// related functionality with Gateways.
	GatewayGRPCConformanceProfile = ConformanceProfile{
		Name: GatewayGRPCConformanceProfileName,
		CoreFeatures: sets.New(
			features.SupportGateway,
			features.SupportReferenceGrant,
			features.SupportGRPCRoute,
		),
		ExtendedFeatures: features.GatewayExtendedFeatures,
	}

	// MeshHTTPConformanceProfile is a ConformanceProfile that covers testing HTTP
	// service mesh related functionality.
	MeshHTTPConformanceProfile = ConformanceProfile{
		Name: MeshHTTPConformanceProfileName,
		CoreFeatures: sets.New(
			features.SupportMesh,
			features.SupportHTTPRoute,
		),
		ExtendedFeatures: sets.New[features.SupportedFeature]().
			Insert(features.HTTPRouteExtendedFeatures.UnsortedList()...).
			Insert(features.SupportMeshClusterIPMatching).
			Insert(features.SupportMeshConsumerRoute),
	}

	// MeshGRPCConformanceProfile is a ConformanceProfile that covers testing GRPC
	// service mesh related functionality.
	MeshGRPCConformanceProfile = ConformanceProfile{
		Name: MeshHTTPConformanceProfileName,
		CoreFeatures: sets.New(
			features.SupportMesh,
			features.SupportGRPCRoute,
		),
		ExtendedFeatures: sets.New[features.SupportedFeature]().
			Insert(features.SupportMeshClusterIPMatching).
			Insert(features.SupportMeshConsumerRoute),
	}
)

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) confv1.Implementation

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[features.SupportedFeature]

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

func RegisterConformanceProfile added in v1.1.0

func RegisterConformanceProfile(p ConformanceProfile)

RegisterConformanceProfile allows downstream tests to register unique profiles that define their own set of features

Types

type ConformanceOptions added in v1.1.0

type ConformanceOptions 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
	ReportOutputPath     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[features.SupportedFeature]
	ExemptFeatures             sets.Set[features.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

	ManifestFS []fs.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

	Mode                string
	AllowCRDsMismatch   bool
	Implementation      confv1.Implementation
	ConformanceProfiles sets.Set[ConformanceProfileName]
}

Options can be used to initialize a ConformanceTestSuite.

type ConformanceProfile added in v0.8.0

type ConformanceProfile struct {
	Name             ConformanceProfileName
	CoreFeatures     sets.Set[features.SupportedFeature]
	ExtendedFeatures sets.Set[features.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 (
	// GatewayHTTPConformanceProfileName indicates the name of the conformance profile
	// which covers HTTP functionality with Gateways.
	GatewayHTTPConformanceProfileName ConformanceProfileName = "GATEWAY-HTTP"

	// GatewayTLSConformanceProfileName indicates the name of the conformance profile
	// which covers TLS stream functionality with Gateways.
	GatewayTLSConformanceProfileName ConformanceProfileName = "GATEWAY-TLS"

	// GatewayGRPCConformanceProfileName indicates the name of the conformance profile
	// which covers GRPC functionality with Gateways.
	GatewayGRPCConformanceProfileName ConformanceProfileName = "GATEWAY-GRPC"

	// MeshHTTPConformanceProfileName indicates the name of the conformance profile
	// which covers HTTP functionality with service mesh.
	MeshHTTPConformanceProfileName ConformanceProfileName = "MESH-HTTP"

	// MeshGRPCConformanceProfileName indicates the name of the conformance profile
	// which covers GRPC functionality with service mesh.
	MeshGRPCConformanceProfileName ConformanceProfileName = "MESH-GRPC"
)

type ConformanceTest

type ConformanceTest struct {
	ShortName   string
	Description string
	Features    []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[features.SupportedFeature]
	TimeoutConfig            config.TimeoutConfig
	SkipTests                sets.Set[string]
	RunTest                  string
	ManifestFS               []fs.FS
	UsableNetworkAddresses   []v1beta1.GatewayAddress
	UnusableNetworkAddresses []v1beta1.GatewayAddress
	// contains filtered or unexported fields
}

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

func NewConformanceTestSuite added in v1.1.0

func NewConformanceTestSuite(options ConformanceOptions) (*ConformanceTestSuite, error)

NewConformanceTestSuite is a helper to use for creating a new ConformanceTestSuite.

func (*ConformanceTestSuite) Report added in v1.1.0

func (suite *ConformanceTestSuite) Report() (*confv1.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 (*ConformanceTestSuite) Run

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

Run runs the provided set of conformance tests.

func (*ConformanceTestSuite) Setup

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

Setup ensures the base resources required for conformance tests are installed in the cluster. It also ensures that all relevant resources are ready.

Jump to

Keyboard shortcuts

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