Documentation ¶
Index ¶
- type ArrayFlags
- type Context
- type ContextFailer
- type Dumper
- type Environment
- type EnvironmentFactory
- type FakeID
- type FakeResource
- type ID
- type ImageSettings
- type IstioVersion
- type IstioVersions
- type Matcher
- type Resource
- type RevVerMap
- func (rv *RevVerMap) AtLeast(v IstioVersion) bool
- func (rv *RevVerMap) Default() string
- func (rv *RevVerMap) IsMultiVersion() bool
- func (rv *RevVerMap) Maximum() IstioVersion
- func (rv *RevVerMap) Minimum() IstioVersion
- func (rv *RevVerMap) Set(value string) error
- func (rv *RevVerMap) SetConfig(mi any) error
- func (rv *RevVerMap) String() string
- func (rv *RevVerMap) TemplateMap() map[string]string
- func (rv *RevVerMap) Versions() IstioVersions
- type Settings
- type SetupFn
- type ShouldSkipFn
- type TeardownFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayFlags ¶
type ArrayFlags []string
func (*ArrayFlags) Set ¶
func (i *ArrayFlags) Set(value string) error
func (*ArrayFlags) String ¶
func (i *ArrayFlags) String() string
type Context ¶
type Context interface { yml.FileWriter // TrackResource tracks a resource in this context. If the context is closed, then the resource will be // cleaned up. TrackResource(r Resource) ID // GetResource accepts either a *T or *[]*T where T implements Resource. // For a non-slice pointer, the value will be assigned to the first matching resource. // For a slice pointer, the matching resources from this scope and its parent(s) will be appended. // If ref is not a pointer, an error will be returned. // If there is no match for a non-slice pointer, an error will be returned. GetResource(ref any) error // The Environment in which the tests run Environment() Environment // Clusters in this Environment. There will always be at least one. Clusters() cluster.Clusters // AllClusters in this Environment, including external control planes. AllClusters() cluster.Clusters // Settings returns common settings Settings() *Settings // Cleanup will trigger the provided cleanup function after the test context // completes. This is identical to CleanupStrategy(Always). // This function may not (safely) access the test context. Cleanup(fn func()) // CleanupConditionally will trigger a cleanup operation the test context // completes, unless -istio.test.nocleanup is set. This is identical to // CleanupStrategy(Conditionally). // This function may not (safely) access the test context. CleanupConditionally(fn func()) // CleanupStrategy runs the given cleanup function after the test context completes, // depending on the provided strategy. // This function may not (safely) access the test context. CleanupStrategy(strategy cleanup.Strategy, fn func()) // CreateDirectory creates a new subdirectory within this context. CreateDirectory(name string) (string, error) // CreateTmpDirectory creates a new temporary directory within this context. CreateTmpDirectory(prefix string) (string, error) // ConfigKube returns a Context that writes config to the provided clusters. If // no clusters are provided, writes to all clusters in the mesh. ConfigKube(clusters ...cluster.Cluster) config.Factory // ConfigIstio returns a Context that writes config to all Istio config clusters. ConfigIstio() config.Factory // RecordTraceEvent records an event. This is later saved to trace.yaml for analysis RecordTraceEvent(key string, value any) // Id returns the name of the context ID() string }
Context is the core context interface that is used by resources.
type ContextFailer ¶
ContextFailer is a Context that is also a Failer. Typically, framework.TestContext can be used for this, but this has some import cycles.
type Dumper ¶
type Dumper interface {
Dump(ctx Context)
}
Dumper is an interface that is implemented by all components that can dump their state. In CI, it is useful to get as much context as possible when a test fails. Dumper allows dumping of state from a test.
type Environment ¶
type Environment interface { Resource EnvironmentName() string // Clusters in this Environment. There will always be at least one. Clusters() cluster.Clusters // AllClusters in this Environment, including external control planes. AllClusters() cluster.Clusters IsMultiCluster() bool IsMultiNetwork() bool }
Environment is the ambient environment that the test runs in.
func NilEnvironmentFactory ¶
func NilEnvironmentFactory(Context) (Environment, error)
NilEnvironmentFactory is an EnvironmentFactory that returns nil.
type EnvironmentFactory ¶
type EnvironmentFactory func(ctx Context) (Environment, error)
EnvironmentFactory creates an Environment.
type FakeResource ¶
FakeResource used for testing.
func (*FakeResource) GetOtherValue ¶
func (f *FakeResource) GetOtherValue() string
GetOtherValue is an additional method used to distinguish this resource API from others.
func (*FakeResource) ID ¶
func (f *FakeResource) ID() ID
type ImageSettings ¶
type ImageSettings struct { // Hub value to use in Helm templates Hub string // Tag value to use in Helm templates Tag string // Variant value to use in Helm templates Variant string // Image pull policy to use for deployments. If not specified, the defaults of each deployment will be used. PullPolicy string // PullSecret path to a file containing a k8s secret in yaml so test pods can pull from protected registries. PullSecret string }
ImageSettings for container images.
func (*ImageSettings) PullSecretName ¶
func (s *ImageSettings) PullSecretName() (string, error)
func (*ImageSettings) PullSecretNameOrFail ¶
func (s *ImageSettings) PullSecretNameOrFail(t test.Failer) string
type IstioVersion ¶
type IstioVersion string
IstioVersion is an Istio version running within a cluster.
func NewIstioVersion ¶
func NewIstioVersion(s string) (IstioVersion, error)
NewIstioVersion creates an IstioVersion with validation.
func (IstioVersion) Compare ¶
func (v IstioVersion) Compare(other IstioVersion) int
Compare compares two Istio versions. Returns -1 if version "v" is less than "other", 0 if the same, and 1 if "v" is greater than "other".
type IstioVersions ¶
type IstioVersions []IstioVersion
IstioVersions represents a collection of Istio versions running in a cluster.
func (IstioVersions) Maximum ¶
func (v IstioVersions) Maximum() IstioVersion
Maximum returns the maximum from a set of IstioVersions returns empty value if no versions.
func (IstioVersions) Minimum ¶
func (v IstioVersions) Minimum() IstioVersion
Minimum returns the minimum from a set of IstioVersions returns empty value if no versions.
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
func NewMatcher ¶
NewMatcher reimplements the logic of Go's -test.run. The code is mostly directly copied from Go's source.
type Resource ¶
type Resource interface { // ID used for debugging the resource instance. ID() ID }
Resource of a resource.
type RevVerMap ¶
type RevVerMap map[string]IstioVersion
RevVerMap maps installed revisions to their Istio versions.
func (*RevVerMap) AtLeast ¶
func (rv *RevVerMap) AtLeast(v IstioVersion) bool
AtLeast returns true if the minimum Istio version under test is at least the given version.
func (*RevVerMap) Default ¶
Default returns the revision with the newest `IstioVersion`, or in the case of a tie, the first alphabetically.
func (*RevVerMap) IsMultiVersion ¶
IsMultiVersion returns whether the associated IstioVersions have multiple specified versions.
func (*RevVerMap) Maximum ¶
func (rv *RevVerMap) Maximum() IstioVersion
Maximum returns the maximum version from the revision-version mapping.
func (*RevVerMap) Minimum ¶
func (rv *RevVerMap) Minimum() IstioVersion
Minimum returns the minimum version from the revision-version mapping.
func (*RevVerMap) Set ¶
Set parses IstioVersions from a string flag in the form "a=1.5.6,b,c=1.4". If no version is specified for a revision assume latest, represented as ""
func (*RevVerMap) TemplateMap ¶
TemplateMap creates a map of revisions and versions suitable for templating.
func (*RevVerMap) Versions ¶
func (rv *RevVerMap) Versions() IstioVersions
Versions returns the Istio versions present in the given RevVerMap.
type Settings ¶
type Settings struct { // Name of the test TestID string RunID uuid.UUID // Do not cleanup the resources after the test run. NoCleanup bool // Indicates that the tests are running in CI Mode CIMode bool // Should the tests fail if usage of deprecated stuff (e.g. Envoy flags) is detected FailOnDeprecation bool // Local working directory root for creating temporary directories / files in. If left empty, // os.TempDir() will be used. BaseDir string // The number of times to retry failed tests. // This should not be depended on as a primary means for reducing test flakes. Retries int // If enabled, namespaces will be reused rather than created with dynamic names each time. // This is useful when combined with NoCleanup, to allow quickly iterating on tests. StableNamespaces bool // The label selector that the user has specified. SelectorString string // The regex specifying which tests to skip. This follows inverted semantics of golang's // -test.run flag, which only supports positive match. If an entire package is meant to be // excluded, it can be filtered with `go list` and explicitly passing the list of desired // packages. For example: `go test $(go list ./... | grep -v bad-package)`. SkipString ArrayFlags SkipMatcher *Matcher // SkipWorkloadClasses can be used to skip deploying special workload types like TPROXY, VMs, etc. SkipWorkloadClasses ArrayFlags // OnlyWorkloadClasses can be used to only deploy specific workload types like TPROXY, VMs, etc. OnlyWorkloadClasses ArrayFlags // The label selector, in parsed form. Selector label.Selector // EnvironmentFactory allows caller to override the environment creation. If nil, a default is used based // on the known environment names. EnvironmentFactory EnvironmentFactory // Deprecated: prefer to use `--istio.test.revisions=<revision name>`. // The revision label on a namespace for injection webhook. // If set to XXX, all the namespaces created with istio-injection=enabled will be replaced with istio.io/rev=XXX. Revision string // Skip VM related parts for all the tests. SkipVM bool // Skip TProxy related parts for all the tests. SkipTProxy bool // Ambient mesh is being used Ambient bool // Use ambient instead of sidecars AmbientEverywhere bool // Compatibility determines whether we should transparently deploy echo workloads attached to each revision // specified in `Revisions` when creating echo instances. Used primarily for compatibility testing between revisions // on different control plane versions. Compatibility bool // Revisions maps the Istio revisions that are available to each cluster to their corresponding versions. // This flag must be used with --istio.test.kube.deploy=false with the versions pre-installed. // This flag should be passed in as comma-separated values, such as "rev-a=1.7.3,rev-b=1.8.2,rev-c=1.9.0", and the test framework will // spin up pods pointing to these revisions for each echo instance and skip tests accordingly. // To configure it so that an Istio revision is on the latest version simply list the revision name without the version (i.e. "rev-a,rev-b") // If using this flag with --istio.test.revision, this flag will take precedence. Revisions RevVerMap // Image settings Image ImageSettings // EchoImage is the app image to be used by echo deployments. EchoImage string // CustomGRPCEchoImage if specified will run an extra container in the echo Pods responsible for gRPC ports CustomGRPCEchoImage string // MaxDumps is the maximum number of full test dumps that are allowed to occur within a test suite. MaxDumps uint64 // EnableDualStack indicates the test should have dual stack enabled or not. EnableDualStack bool // Helm repo to be used for tests HelmRepo string DisableDefaultExternalServiceConnectivity bool PeerMetadataDiscovery bool // GatewayConformanceStandardOnly indicates that only the standard gateway conformance tests should be run. GatewayConformanceStandardOnly bool GatewayConformanceTimeoutConfig gwConformanceConfig.TimeoutConfig // OpenShift indicates the tests run in an OpenShift platform rather than in plain Kubernetes. OpenShift bool }
Settings is the set of arguments to the test driver.
func DefaultSettings ¶
func DefaultSettings() *Settings
DefaultSettings returns a default settings instance.
func SettingsFromCommandLine ¶
SettingsFromCommandLine returns settings obtained from command-line flags. config.Parse must be called before calling this function.
func (*Settings) OnlyWorkloadClassesAsSet ¶
func (*Settings) SkipVMs ¶
func (s *Settings) SkipVMs()
SkipVMs changes the skip settings at runtime
func (*Settings) SkipWorkloadClassesAsSet ¶
type ShouldSkipFn ¶
ShouldSkipFn is a function used for performing skip actions; if it returns true a job is skipped Note: function may be called multiple times during the setup process.
type TeardownFn ¶
type TeardownFn func(ctx Context)
TeardownFn is a function used for performing tear-down actions.