e2e

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 40 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AddPrefix

func AddPrefix(containerId string, runtime Runtime) string

func AssertLogContains

func AssertLogContains(t *testing.T, m *Minikube, pod metav1.Object, expectedLog string)

func AssertLogContainsWithTimeout added in v1.0.2

func AssertLogContainsWithTimeout(t *testing.T, m *Minikube, pod metav1.Object, expectedLog string, timeout time.Duration)

func AssertProcessNOTRunningInContainer

func AssertProcessNOTRunningInContainer(t *testing.T, m *Minikube, pod metav1.Object, containername string, comm string)

func AssertProcessRunningInContainer

func AssertProcessRunningInContainer(t *testing.T, m *Minikube, pod metav1.Object, containername string, comm string, showAll bool)

func ContainsAttribute added in v1.0.13

func ContainsAttribute(attributes map[string][]string, key, value string) bool

func GetContainerStatus

func GetContainerStatus(m *Minikube, pod metav1.Object, containername string) (*corev1.ContainerStatus, error)

func HasAttribute

func HasAttribute(target discovery_kit_api.Target, key, value string) bool

func NewContainerTarget

func NewContainerTarget(m *Minikube, pod metav1.Object, containername string) (*action_kit_api.Target, error)

func PollForEnrichmentData added in v1.0.13

func PollForEnrichmentData(ctx context.Context, e *Extension, targetId string, predicate func(target discovery_kit_api.EnrichmentData) bool) (discovery_kit_api.EnrichmentData, error)

func PollForTarget

func PollForTarget(ctx context.Context, e *Extension, targetId string, predicate func(target discovery_kit_api.Target) bool) (discovery_kit_api.Target, error)

func RemovePrefix

func RemovePrefix(containerId string) string

func Retry

func Retry(t *testing.T, maxAttempts int, sleep time.Duration, f func(r *R)) bool

func WaitForContainerStatusUsingContainerEngine

func WaitForContainerStatusUsingContainerEngine(m *Minikube, containerId string, wantedStatus string) error

func WithDefaultMinikube

func WithDefaultMinikube(t *testing.T, ext ExtensionFactory, testCases []WithMinikubeTestCase)

func WithMinikube

func WithMinikube(t *testing.T, mOpts MinikubeOpts, ext ExtensionFactory, testCases []WithMinikubeTestCase)

Types

type Extension

type Extension struct {
	Client *resty.Client

	Pod metav1.Object
	// contains filtered or unexported fields
}

func (*Extension) DiscoverEnrichmentData added in v1.1.0

func (e *Extension) DiscoverEnrichmentData(discoveryId string) ([]discovery_kit_api.EnrichmentData, error)

func (*Extension) DiscoverTargets

func (e *Extension) DiscoverTargets(discoveryId string) ([]discovery_kit_api.Target, error)

func (*Extension) RunAction

func (e *Extension) RunAction(actionId string, target *action_kit_api.Target, config interface{}, executionContext *action_kit_api.ExecutionContext) (aclient.ActionExecution, error)

func (*Extension) RunActionWithFiles

func (e *Extension) RunActionWithFiles(actionId string, target *action_kit_api.Target, config interface{}, executionContext *action_kit_api.ExecutionContext, files []aclient.File) (aclient.ActionExecution, error)

type ExtensionFactory

type ExtensionFactory interface {
	CreateImage() error
	Start(minikube *Minikube) (*Extension, error)
}

type HelmExtensionFactory

type HelmExtensionFactory struct {
	Name             string
	ImageName        string
	ImageTag         string
	Port             uint16
	ChartPath        string
	PodLabelSelector string
	ExtraArgs        func(minikube *Minikube) []string
}

func (*HelmExtensionFactory) CreateImage

func (h *HelmExtensionFactory) CreateImage() error

func (*HelmExtensionFactory) Start

func (h *HelmExtensionFactory) Start(minikube *Minikube) (*Extension, error)

type Iperf

type Iperf struct {
	Minikube  *Minikube
	ServerPod metav1.Object
	ClientPod metav1.Object
	ServerIp  string
}

func (*Iperf) AssertBandwidth

func (n *Iperf) AssertBandwidth(t *testing.T, min float64, max float64)

func (*Iperf) AssertPackageLoss

func (n *Iperf) AssertPackageLoss(t *testing.T, min float64, max float64)

func (*Iperf) AssertPackageLossWithRetry added in v1.0.8

func (n *Iperf) AssertPackageLossWithRetry(min float64, max float64, maxRetries int) bool

func (*Iperf) Delete

func (n *Iperf) Delete() error

func (*Iperf) Deploy

func (n *Iperf) Deploy(name string, opts ...func(server *acorev1.PodApplyConfiguration, client *acorev1.PodApplyConfiguration)) error

func (*Iperf) MeasureBandwidth

func (n *Iperf) MeasureBandwidth() (float64, error)

func (*Iperf) MeasurePackageLoss

func (n *Iperf) MeasurePackageLoss() (float64, error)

func (*Iperf) Target

func (n *Iperf) Target() (*action_kit_api.Target, error)

type Minikube

type Minikube struct {
	Runtime Runtime
	Driver  string
	Profile string

	Client       *kubernetes.Clientset
	ClientConfig *rest.Config
	// contains filtered or unexported fields
}

func (*Minikube) Config

func (m *Minikube) Config() *rest.Config

func (*Minikube) CreateDeployment added in v1.0.12

func (m *Minikube) CreateDeployment(deployment *appsv1.Deployment) (metav1.Object, []corev1.Pod, error)

func (*Minikube) CreatePod

func (m *Minikube) CreatePod(pod *acorev1.PodApplyConfiguration) (metav1.Object, error)

func (*Minikube) CreateService

func (m *Minikube) CreateService(service *acorev1.ServiceApplyConfiguration) (metav1.Object, error)

func (*Minikube) DeleteDeployment added in v1.0.12

func (m *Minikube) DeleteDeployment(deployment metav1.Object) error

func (*Minikube) DeletePod

func (m *Minikube) DeletePod(pod metav1.Object) error

func (*Minikube) DeleteService

func (m *Minikube) DeleteService(service metav1.Object) error

func (*Minikube) Exec

func (m *Minikube) Exec(pod metav1.Object, containername string, cmd ...string) (string, error)

Exec executes a command in a container of a pod Deprecated: Please use PodExec instead

func (*Minikube) GetClient

func (m *Minikube) GetClient() *kubernetes.Clientset

func (*Minikube) GetPod

func (m *Minikube) GetPod(pod metav1.Object) (*corev1.Pod, error)

func (*Minikube) GetRuntime

func (m *Minikube) GetRuntime() Runtime

func (*Minikube) ListPods

func (m *Minikube) ListPods(ctx context.Context, namespace, matchLabels string) ([]corev1.Pod, error)

func (*Minikube) LoadImage

func (m *Minikube) LoadImage(image string) error

func (*Minikube) NewRestClientForService

func (m *Minikube) NewRestClientForService(service metav1.Object) (*ServiceClient, error)

func (*Minikube) PodExec added in v1.0.5

func (m *Minikube) PodExec(pod metav1.Object, containername string, cmd ...string) (string, error)

func (*Minikube) PortForward

func (m *Minikube) PortForward(pod metav1.Object, remotePort uint16, stopCh <-chan struct{}) (uint16, error)

func (*Minikube) SshExec added in v1.0.5

func (m *Minikube) SshExec(arg ...string) *exec.Cmd

func (*Minikube) TailLog

func (m *Minikube) TailLog(ctx context.Context, pod metav1.Object)

func (*Minikube) TunnelService

func (m *Minikube) TunnelService(service metav1.Object) (string, func(), error)

func (*Minikube) WaitForDeploymentPhase added in v1.0.12

func (m *Minikube) WaitForDeploymentPhase(deployment metav1.Object, phase corev1.PodPhase, labelSelector string, duration time.Duration) ([]corev1.Pod, error)

func (*Minikube) WaitForPodPhase

func (m *Minikube) WaitForPodPhase(pod metav1.Object, phase corev1.PodPhase, duration time.Duration) error

func (*Minikube) WaitForPodReady added in v1.2.6

func (m *Minikube) WaitForPodReady(pod metav1.Object, duration time.Duration) error

type MinikubeOpts

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

func DefaultMinikubeOpts added in v1.1.0

func DefaultMinikubeOpts() MinikubeOpts

func (MinikubeOpts) AfterStart added in v1.1.0

func (o MinikubeOpts) AfterStart(f func(m *Minikube) error) MinikubeOpts

AfterStart the after start callback will be called *after* the minikube cluster and *before* the extension is started.

func (MinikubeOpts) WithDriver added in v1.1.0

func (o MinikubeOpts) WithDriver(driver string) MinikubeOpts

func (MinikubeOpts) WithRuntimes added in v1.1.0

func (o MinikubeOpts) WithRuntimes(runtimes ...Runtime) MinikubeOpts

type Netperf

type Netperf struct {
	Minikube  *Minikube
	ServerPod metav1.Object
	ClientPod metav1.Object
	ServerIp  string
}

func (*Netperf) AssertLatency

func (n *Netperf) AssertLatency(t *testing.T, min time.Duration, max time.Duration)

func (*Netperf) Delete

func (n *Netperf) Delete() error

func (*Netperf) Deploy

func (n *Netperf) Deploy(name string, opts ...func(server *acorev1.PodApplyConfiguration, client *acorev1.PodApplyConfiguration)) error

func (*Netperf) MeasureLatency

func (n *Netperf) MeasureLatency() (time.Duration, error)

func (*Netperf) Target

func (n *Netperf) Target() (*action_kit_api.Target, error)

type Nginx

type Nginx struct {
	Minikube *Minikube
	Pod      metav1.Object
	Service  metav1.Object
}

func (*Nginx) AssertCanReach

func (n *Nginx) AssertCanReach(t *testing.T, url string, expected bool)

func (*Nginx) AssertCannotReach

func (n *Nginx) AssertCannotReach(t *testing.T, url string, errContains string)

func (*Nginx) AssertIsReachable

func (n *Nginx) AssertIsReachable(t *testing.T, expected bool)

func (*Nginx) CanReach

func (n *Nginx) CanReach(url string) error

func (*Nginx) ContainerStatus

func (n *Nginx) ContainerStatus() (*corev1.ContainerStatus, error)

func (*Nginx) Delete

func (n *Nginx) Delete() error

func (*Nginx) Deploy

func (n *Nginx) Deploy(podName string, opts ...func(c *acorev1.PodApplyConfiguration)) error

func (*Nginx) IsReachable

func (n *Nginx) IsReachable() error

func (*Nginx) Target

func (n *Nginx) Target() (*action_kit_api.Target, error)

type NginxDeployment added in v1.0.12

type NginxDeployment struct {
	Minikube   *Minikube
	Deployment metav1.Object
	Service    metav1.Object
	Pods       []corev1.Pod
}

func (*NginxDeployment) AssertIsReachable added in v1.0.12

func (n *NginxDeployment) AssertIsReachable(t *testing.T, expected bool)

func (*NginxDeployment) ContainerStatus added in v1.0.12

func (n *NginxDeployment) ContainerStatus() (*corev1.ContainerStatus, error)

func (*NginxDeployment) Delete added in v1.0.12

func (n *NginxDeployment) Delete() error

func (*NginxDeployment) Deploy added in v1.0.12

func (n *NginxDeployment) Deploy(deploymentName string) error

func (*NginxDeployment) IsReachable added in v1.0.12

func (n *NginxDeployment) IsReachable() error

func (*NginxDeployment) Target added in v1.0.12

func (n *NginxDeployment) Target() (*action_kit_api.Target, error)

type R

type R struct {
	// The number of current attempt.
	Attempt int

	Failed bool
	Log    *bytes.Buffer
}

R is passed to each run of a flaky test run, manages state and accumulates log statements.

type Runtime

type Runtime string
const (
	RuntimeContainerd Runtime = "containerd"
	RuntimeDocker     Runtime = "docker"
	RuntimeCrio       Runtime = "cri-o"
)

type ServiceClient

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

func (*ServiceClient) Close

func (c *ServiceClient) Close()

func (*ServiceClient) R added in v1.2.2

func (c *ServiceClient) R() *resty.Request

type WithMinikubeTestCase

type WithMinikubeTestCase struct {
	Name string
	Test func(t *testing.T, minikube *Minikube, e *Extension)
}

Jump to

Keyboard shortcuts

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