runner

package
v1.9.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 10 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
	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) 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) 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) 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.

type PlatformInterface

type PlatformInterface interface {
	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)
	// contains filtered or unexported methods
}

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) Start

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

Start is the entry point of Dapr test runner.

Jump to

Keyboard shortcuts

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