istio: istio.io/istio/pkg/test/framework/resource Index | Files | Directories

package resource

import "istio.io/istio/pkg/test/framework/resource"

Index

Package Files

cluster.go context.go dumper.go environment.go flags.go resource.go settings.go setup.go

func UnsupportedEnvironment Uses

func UnsupportedEnvironment(env Environment) error

UnsupportedEnvironment generates an error indicating that the given environment is not supported.

type Cluster Uses

type Cluster interface {
    fmt.Stringer

    // Index of this Cluster within the Environment
    Index() ClusterIndex

    // IsControlPlaneCluster indicates whether or not a control plane has/should have a control plane deployed.
    IsControlPlaneCluster() bool
}

Cluster in a multicluster environment.

type ClusterIndex Uses

type ClusterIndex int

ClusterIndex is the index of a cluster within the Environment

type Context Uses

type Context interface {
    // TrackResource tracks a resource in this context. If the context is closed, then the resource will be
    // cleaned up.
    TrackResource(r Resource) ID

    // The Environment in which the tests run
    Environment() Environment

    // Settings returns common settings
    Settings() *Settings

    // 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)
}

Context is the core context interface that is used by resources.

type Dumper Uses

type Dumper interface {
    Dump()
}

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 Uses

type Environment interface {
    Resource

    EnvironmentName() environment.Name

    // IsMulticluster is a utility method that indicates whether there are multiple Clusters available.
    IsMulticluster() bool

    // Clusters in this Environment. There will always be at least one.
    Clusters() []Cluster

    // Case calls the given function if this environment has the given name.
    Case(e environment.Name, fn func())
}

Environment is the ambient environment that the test runs in.

type EnvironmentFactory Uses

type EnvironmentFactory func(name string, ctx Context) (Environment, error)

EnvironmentFactory is a function that creates an Environment by name.

type ID Uses

type ID interface {
    fmt.Stringer
}

ID for the resource instance. This is allocated by the framework and passed here.

type Resource Uses

type Resource interface {

    // Debugging ID for the resource instance.
    ID() ID
}

Resource of a resource.

type Settings Uses

type Settings struct {
    // Name of the test
    TestID string

    RunID uuid.UUID

    // Environment to run the tests in. By default, a local environment will be used.
    Environment string

    // 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

    // The label selector that the user has specified.
    SelectorString string

    // 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
}

Settings is the set of arguments to the test driver.

func DefaultSettings Uses

func DefaultSettings() *Settings

DefaultSettings returns a default settings instance.

func SettingsFromCommandLine Uses

func SettingsFromCommandLine(testID string) (*Settings, error)

SettingsFromCommandLine returns settings obtained from command-line flags. flag.Parse must be called before calling this function.

func (*Settings) Clone Uses

func (s *Settings) Clone() *Settings

Clone settings

func (*Settings) RunDir Uses

func (s *Settings) RunDir() string

RunDir is the name of the dir to output, for this particular run.

func (*Settings) String Uses

func (s *Settings) String() string

String implements fmt.Stringer

type SetupFn Uses

type SetupFn func(ctx Context) error

SetupFn is a function used for performing setup actions.

Directories

PathSynopsis
environment

Package resource imports 8 packages (graph) and is imported by 54 packages. Updated 2020-04-07. Refresh now. Tools for package owners.