Documentation ¶
Index ¶
- type Case
- type Harness
- func (h *Harness) Client(forceNew bool) (client.Client, error)
- func (h *Harness) Config() (*rest.Config, error)
- func (h *Harness) DiscoveryClient() (discovery.DiscoveryInterface, error)
- func (h *Harness) DockerClient() (testutils.DockerClient, error)
- func (h *Harness) GetLogger() testutils.Logger
- func (h *Harness) GetTimeout() int
- func (h *Harness) LoadTests(dir string) ([]*Case, error)
- func (h *Harness) Run()
- func (h *Harness) RunKIND() (*rest.Config, error)
- func (h *Harness) RunKUDO() error
- func (h *Harness) RunTestEnv() (*rest.Config, error)
- func (h *Harness) RunTests()
- func (h *Harness) Stop()
- type Step
- func (s *Step) Check(namespace string) []error
- func (s *Step) CheckResource(expected runtime.Object, namespace string) []error
- func (s *Step) CheckResourceAbsent(expected runtime.Object, namespace string) error
- func (s *Step) Clean(namespace string) error
- func (s *Step) Create(namespace string) []error
- func (s *Step) DeleteExisting(namespace string) error
- func (s *Step) GetTimeout() int
- func (s *Step) LoadYAML(file string) error
- func (s *Step) Run(namespace string) []error
- func (s *Step) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Case ¶
type Case struct { Steps []*Step Name string Dir string SkipDelete bool Timeout int Client func(forceNew bool) (client.Client, error) DiscoveryClient func() (discovery.DiscoveryInterface, error) Logger testutils.Logger }
Case contains all of the test steps and the Kubernetes client and other global configuration for a test.
func (*Case) CollectEvents ¶ added in v0.7.0
CollectEvents gathers all events from namespace and prints it out to log
func (*Case) CollectTestStepFiles ¶
CollectTestStepFiles collects a map of test steps and their associated files from a directory.
func (*Case) CreateNamespace ¶
CreateNamespace creates a namespace in Kubernetes to use for a test.
func (*Case) DeleteNamespace ¶
DeleteNamespace deletes a namespace in Kubernetes after we are done using it.
func (*Case) LoadTestSteps ¶
LoadTestSteps loads all of the test steps for a test case.
type Harness ¶
type Harness struct { TestSuite kudo.TestSuite T *testing.T // contains filtered or unexported fields }
Harness loads and runs tests based on the configuration provided.
func (*Harness) Config ¶
Config returns the current Kubernetes configuration - either from the environment or from the created temporary control plane.
func (*Harness) DiscoveryClient ¶
func (h *Harness) DiscoveryClient() (discovery.DiscoveryInterface, error)
DiscoveryClient returns the current Kubernetes discovery client for the test harness.
func (*Harness) DockerClient ¶ added in v0.7.0
func (h *Harness) DockerClient() (testutils.DockerClient, error)
DockerClient returns the Docker client to use for the test harness.
func (*Harness) GetTimeout ¶ added in v0.4.0
GetTimeout returns the configured timeout for the test suite.
func (*Harness) Run ¶
func (h *Harness) Run()
Run the test harness - start KUDO and the control plane and install the operators, if necessary and then run the tests.
func (*Harness) RunTestEnv ¶
RunTestEnv starts a Kubernetes API server and etcd server for use in the tests and returns the Kubernetes configuration.
type Step ¶
type Step struct { Name string Index int Dir string Step *kudo.TestStep Assert *kudo.TestAssert Asserts []runtime.Object Apply []runtime.Object Errors []runtime.Object Timeout int Client func(forceNew bool) (client.Client, error) DiscoveryClient func() (discovery.DiscoveryInterface, error) Logger testutils.Logger }
A Step contains the name of the test step, its index in the test, and all of the test step's settings (including objects to apply and assert on).
func (*Step) Check ¶
Check checks if the resources defined in Asserts and Errors are in the correct state.
func (*Step) CheckResource ¶
CheckResource checks if the expected resource's state in Kubernetes is correct.
func (*Step) CheckResourceAbsent ¶ added in v0.7.0
CheckResourceAbsent checks if the expected resource's state is absent in Kubernetes.
func (*Step) DeleteExisting ¶ added in v0.4.0
DeleteExisting deletes any resources in the TestStep.Delete list prior to running the tests.
func (*Step) GetTimeout ¶
GetTimeout gets the timeout defined for the test step.
func (*Step) LoadYAML ¶
LoadYAML loads the resources from a YAML file for a test step:
- If the YAML file is called "assert", then it contains objects to add to the test step's list of assertions.
- If the YAML file is called "errors", then it contains objects that, if seen, mark a test immediately failed.
- All other YAML files are considered resources to create.