framework

package
v0.0.0-...-ed4b1df Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AsyncOpsTimeoutMins = time.Minute * 5
)

Variables

This section is empty.

Functions

func ConfigToVars

func ConfigToVars(c TestRunConfig) (kubeconfigPath, dsiNamePrefix, dataservice, namespace string)

func GenerateName

func GenerateName(name string, id, suffixLength int) string

func GenerateRandString

func GenerateRandString(n int) string

GenerateRandString generates a random string of fixed size.

func GetPrimaryPodUsingServiceSelector

func GetPrimaryPodUsingServiceSelector(ctx context.Context,
	dsi runtimeClient.Object,
	c runtimeClient.Client,
) (*corev1.Pod, error)

TODO: Wait for primary pod explicitly in test setup rather than here. Asynchronous assertions are better exposed at the top level of the setup than hidden within the port forward logic itself. GetPrimaryPodUsingServiceSelector requires an eventually assertion since Patroni only applies the master label once quorum has been achieved. We must wait for this before we can know which pod to portforward to using the service selector.

func PortForward

func PortForward(ctx context.Context,
	targetPort int,
	pathToKubeConfig string,
	dsi runtimeClient.Object,
	c runtimeClient.Client,
) (chan struct{}, int, error)

PortForward establishes a port-forward from a randomly selected local port to port `targetPort` of `dsi`. To terminate the port-forward, close the returned channel. The other return arguments are the selected local port, and an error in case of failure.

func PortForwardPod

func PortForwardPod(ctx context.Context,
	targetPort int,
	pathToKubeConfig string,
	pod *corev1.Pod,
	c runtimeClient.Client,
) (chan struct{}, int, error)

PortForwardPod d establishes a port-forward from a randomly selected local port to port `targetPort` of `pod`.

To terminate the port-forward, close the returned channel.
The other return arguments are the selected local port, and an error in case of failure.

func UniqueName

func UniqueName(name string, length int) string

Types

type TestRunConfig

type TestRunConfig struct {
	// KubeconfigPath is the path to the kube config to be used by the Kubernetes client
	KubeconfigPath string
	// Dataservice is the dataservice the tests are to be performed on
	Dataservice string
	// DSINamePrefix provides a name that the DSI object will take in the cluster
	DSINamePrefix string
	// Namespace provides the target namespace to be used for testing. If not given then a
	// unique namespace is created.
	Namespace string
}

func ParseEnv

func ParseEnv() (TestRunConfig, error)

TODO: Use marshalling approach to provide more fine grained feedback on missing environment variables.

Directories

Path Synopsis
chaos is a utility package for injecting faults into running instances.
chaos is a utility package for injecting faults into running instances.

Jump to

Keyboard shortcuts

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