runner

package
v1.14.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTestImageName added in v1.9.0

func BuildTestImageName(appName string) string

BuildTestImage name uses the default registry and tag to build a image name for the given test app.

Types

type AppUsage added in v0.10.0

type AppUsage struct {
	CPUm     int64
	MemoryMb float64
}

AppUsage holds the CPU and Memory information for the application.

type Disposable

type Disposable interface {
	Name() string
	Init(ctx context.Context) error
	Dispose(wait bool) error
}

Disposable is an interface representing the disposable test resources.

type KubeTestPlatform

type KubeTestPlatform struct {
	AppResources       *TestResources
	ComponentResources *TestResources
	Secrets            *TestResources
	KubeClient         *kube.KubeClient
}

KubeTestPlatform includes K8s client for testing cluster and kubernetes testing apps.

func NewKubeTestPlatform

func NewKubeTestPlatform() *KubeTestPlatform

NewKubeTestPlatform creates KubeTestPlatform instance.

func (*KubeTestPlatform) AcquireAppExternalURL

func (c *KubeTestPlatform) AcquireAppExternalURL(name string) string

AcquireAppExternalURL returns the external url for 'name'.

func (*KubeTestPlatform) AddApps added in v1.10.0

func (c *KubeTestPlatform) AddApps(apps []kube.AppDescription) error

addApps adds test apps to disposable App Resource queues.

func (*KubeTestPlatform) AddComponents added in v1.10.0

func (c *KubeTestPlatform) AddComponents(comps []kube.ComponentDescription) error

addComponents adds component to disposable Resource queues.

func (*KubeTestPlatform) AddSecrets added in v1.12.0

func (c *KubeTestPlatform) AddSecrets(secrets []kube.SecretDescription) error

AddSecrets adds secrets to disposable Resource queues.

func (*KubeTestPlatform) GetAppHostDetails added in v0.8.0

func (c *KubeTestPlatform) GetAppHostDetails(name string) (string, string, error)

GetAppHostDetails returns the name and IP address of the host(pod) running 'name'.

func (*KubeTestPlatform) GetAppUsage added in v0.10.0

func (c *KubeTestPlatform) GetAppUsage(appName string) (*AppUsage, error)

GetAppUsage returns the Cpu and Memory usage for the app container for a given app.

func (*KubeTestPlatform) GetConfiguration added in v1.7.0

func (c *KubeTestPlatform) GetConfiguration(name string) (*configurationv1alpha1.Configuration, error)

GetConfiguration returns configuration by name.

func (*KubeTestPlatform) GetOrCreateNamespace added in v1.12.0

func (c *KubeTestPlatform) GetOrCreateNamespace(parentCtx context.Context, namespace string) (*corev1.Namespace, error)

GetOrCreateNamespace gets or creates namespace unless namespace exists.

func (*KubeTestPlatform) GetService added in v1.9.0

func (c *KubeTestPlatform) GetService(name string) (*corev1.Service, error)

func (*KubeTestPlatform) GetSidecarUsage added in v1.0.0

func (c *KubeTestPlatform) GetSidecarUsage(appName string) (*AppUsage, error)

GetSidecarUsage returns the Cpu and Memory usage for the dapr container for a given app.

func (*KubeTestPlatform) GetTotalRestarts added in v1.0.0

func (c *KubeTestPlatform) GetTotalRestarts(appName string) (int, error)

GetTotalRestarts returns the total of restarts across all pods and containers for an app.

func (*KubeTestPlatform) LoadTest added in v1.10.0

func (c *KubeTestPlatform) LoadTest(loadtester LoadTester) error

func (*KubeTestPlatform) PortForwardToApp added in v0.8.0

func (c *KubeTestPlatform) PortForwardToApp(appName string, targetPorts ...int) ([]int, error)

PortForwardToApp opens a new connection to the app on a the target port and returns the local port or error.

func (*KubeTestPlatform) Restart added in v0.3.0

func (c *KubeTestPlatform) Restart(name string) error

Restart restarts all instances for the app.

func (*KubeTestPlatform) Scale added in v0.3.0

func (c *KubeTestPlatform) Scale(name string, replicas int32) error

Scale changes the number of replicas of the app.

func (*KubeTestPlatform) SetAppEnv added in v1.3.0

func (c *KubeTestPlatform) SetAppEnv(name, key, value string) error

SetAppEnv sets the container environment variable.

func (*KubeTestPlatform) Setup added in v1.10.0

func (c *KubeTestPlatform) Setup() (err error)

func (*KubeTestPlatform) TearDown added in v1.10.0

func (c *KubeTestPlatform) TearDown() error

type LoadTester added in v1.10.0

type LoadTester interface {
	Run(platform PlatformInterface) error
}

type PlatformInterface

type PlatformInterface interface {
	Setup() error
	TearDown() error

	AddComponents(comps []kube.ComponentDescription) error
	AddApps(apps []kube.AppDescription) error
	AddSecrets(secrets []kube.SecretDescription) error
	AcquireAppExternalURL(name string) string
	GetAppHostDetails(name string) (string, string, error)
	Restart(name string) error
	Scale(name string, replicas int32) error
	PortForwardToApp(appName string, targetPort ...int) ([]int, error)
	SetAppEnv(appName, key, value string) error
	GetAppUsage(appName string) (*AppUsage, error)
	GetSidecarUsage(appName string) (*AppUsage, error)
	GetTotalRestarts(appname string) (int, error)
	GetConfiguration(name string) (*configurationv1alpha1.Configuration, error)
	GetService(name string) (*corev1.Service, error)
	LoadTest(loadtester LoadTester) error
}

PlatformInterface defines the testing platform for test runner.

type TestResources

type TestResources struct {
	// contains filtered or unexported fields
}

TestResources holds initial resources and active resources.

func (*TestResources) Add

func (r *TestResources) Add(dr Disposable)

Add adds Disposable resource to resources queue.

func (*TestResources) FindActiveResource

func (r *TestResources) FindActiveResource(name string) Disposable

FindActiveResource finds active resource by resource name.

type TestRunner

type TestRunner struct {

	// Platform is the testing platform instances
	Platform PlatformInterface
	// contains filtered or unexported fields
}

TestRunner holds initial test apps and testing platform instance maintains apps and platform for e2e test.

func NewTestRunner

func NewTestRunner(id string, apps []kube.AppDescription,
	comps []kube.ComponentDescription,
	initApps []kube.AppDescription,
) *TestRunner

NewTestRunner returns TestRunner instance for e2e test.

func (*TestRunner) AddSecrets added in v1.12.0

func (tr *TestRunner) AddSecrets(secrets []kube.SecretDescription)

func (*TestRunner) Start

func (tr *TestRunner) Start(m runnable) int

Start is the entry point of Dapr test runner.

func (*TestRunner) TearDown added in v1.10.0

func (tr *TestRunner) TearDown()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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