e2e

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsAttribute

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

func FindAvailablePort

func FindAvailablePort(startPort, endPort int) (int, error)

func FindAvailablePorts

func FindAvailablePorts(startPort, endPort int, count int) (int, error)

func HasAttribute

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

func IsPortAvailable

func IsPortAvailable(port int) bool

IsPortAvailable checks the wildcard and the loopback address: on Windows a wildcard bind succeeds next to a process bound to 127.0.0.1 only (like the extension's own health server), while the test servers listening on 127.0.0.1 would then fail.

func Retry

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

func WithEnvironment

func WithEnvironment(t *testing.T, environment Environment, extFactory ExtensionFactory, testCases []WithTestCase)

Types

type Environment

type Environment interface {
	BuildTarget(ctx context.Context) *action_kit_api.Target
	FindProcessIds(ctx context.Context, command string) []int
	ExecuteProcess(ctx context.Context, command string, parameters ...string) (string, error)
	StartAndAwaitProcess(ctx context.Context, command string, awaitFn func(string) bool, parameters ...string) (func(), error)
	StopProcess(ctx context.Context, commandOrPid string) error
}

type Extension

type Extension interface {
	Client() *resty.Client
	DiscoverTargets(discoveryId string) ([]discovery_kit_api.Target, error)
	DiscoverEnrichmentData(discoveryId string) ([]discovery_kit_api.EnrichmentData, error)
	RunAction(actionId string, target *action_kit_api.Target, config any, executionContext *action_kit_api.ExecutionContext) (aclient.ActionExecution, error)
	RunActionWithFiles(actionId string, target *action_kit_api.Target, config any, executionContext *action_kit_api.ExecutionContext, files []aclient.File) (aclient.ActionExecution, error)
	PollForTarget(ctx context.Context, targetId string, predicate func(target discovery_kit_api.Target) bool) (discovery_kit_api.Target, error)
	PollForEnrichmentData(ctx context.Context, targetId string, predicate func(target discovery_kit_api.EnrichmentData) bool) (discovery_kit_api.EnrichmentData, error)
}

type ExtensionFactory

type ExtensionFactory interface {
	Create(ctx context.Context, environment Environment) error
	Start(ctx context.Context, environment Environment) (Extension, error)
	Stop(ctx context.Context, environment Environment, extension Extension) error
}

type HttpNetperf

type HttpNetperf struct {
	Ip   string
	Port int
	// contains filtered or unexported fields
}

func NewHttpNetperf

func NewHttpNetperf(port int) *HttpNetperf

func (*HttpNetperf) AssertLatency

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

func (*HttpNetperf) CanReach

func (n *HttpNetperf) CanReach(targetUrl string) bool

func (*HttpNetperf) Delete

func (n *HttpNetperf) Delete() error

func (*HttpNetperf) Deploy

func (n *HttpNetperf) Deploy(ctx context.Context, env Environment) error

func (*HttpNetperf) IsReachable

func (n *HttpNetperf) IsReachable() bool

func (*HttpNetperf) MeasureLatency

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

type Iperf

type Iperf struct {
	Ip   string
	Port int
	// contains filtered or unexported fields
}

func NewIperf

func NewIperf(server string, port int) *Iperf

func (*Iperf) AssertBandwidth

func (n *Iperf) AssertBandwidth(t *testing.T, ctx context.Context, env Environment, min float64, max float64)

func (*Iperf) AssertPackageLoss

func (n *Iperf) AssertPackageLoss(t *testing.T, ctx context.Context, env Environment, min float64, max float64)

func (*Iperf) AssertPackageLossWithRetry

func (n *Iperf) AssertPackageLossWithRetry(ctx context.Context, env Environment, min float64, max float64, maxRetries int) bool

func (*Iperf) Delete

func (n *Iperf) Delete() error

func (*Iperf) Deploy

func (n *Iperf) Deploy(ctx context.Context, env Environment) error

func (*Iperf) Install

func (n *Iperf) Install() error

func (*Iperf) MeasureBandwidth

func (n *Iperf) MeasureBandwidth(ctx context.Context, env Environment) (float64, error)

func (*Iperf) MeasurePackageLoss

func (n *Iperf) MeasurePackageLoss(ctx context.Context, env Environment) (float64, error)

type LocalEnvironment

type LocalEnvironment struct {
	Profile string
}

func (*LocalEnvironment) BuildTarget

func (*LocalEnvironment) ExecuteProcess

func (l *LocalEnvironment) ExecuteProcess(ctx context.Context, command string, parameters ...string) (string, error)

func (*LocalEnvironment) FindProcessIds

func (l *LocalEnvironment) FindProcessIds(_ context.Context, name string) []int

func (*LocalEnvironment) StartAndAwaitProcess

func (l *LocalEnvironment) StartAndAwaitProcess(ctx context.Context, command string, awaitFn func(string) bool, parameters ...string) (func(), error)

func (*LocalEnvironment) StopProcess

func (l *LocalEnvironment) StopProcess(_ context.Context, commandOrPid string) error

type LocalExtension

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

func NewLocalExtension

func NewLocalExtension(extensionBaseUrl string) *LocalExtension

func (*LocalExtension) Client

func (e *LocalExtension) Client() *resty.Client

func (*LocalExtension) DiscoverEnrichmentData

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

func (*LocalExtension) DiscoverTargets

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

func (*LocalExtension) PollForEnrichmentData

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

func (*LocalExtension) PollForTarget

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

func (*LocalExtension) RunAction

func (e *LocalExtension) RunAction(actionId string, target *action_kit_api.Target, config any, executionContext *action_kit_api.ExecutionContext) (aclient.ActionExecution, error)

func (*LocalExtension) RunActionWithFiles

func (e *LocalExtension) RunActionWithFiles(actionId string, target *action_kit_api.Target, config any, executionContext *action_kit_api.ExecutionContext, files []aclient.File) (aclient.ActionExecution, error)

type LocalExtensionFactory

type LocalExtensionFactory struct {
	Name       string
	Port       int
	Executable string
	Command    *exec.Cmd
	ExtraArgs  func() []string
	ExtraEnv   func() map[string]string
}

func (*LocalExtensionFactory) Create

func (*LocalExtensionFactory) Start

func (*LocalExtensionFactory) Stop

type PrefixWriter

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

func (*PrefixWriter) Write

func (p *PrefixWriter) Write(buf []byte) (n int, err error)

type R

type R struct {
	// The number of current attempt.
	Attempt int
	Failed  bool
	Log     *bytes.Buffer
}

type WithTestCase

type WithTestCase struct {
	Name string
	Test func(t *testing.T, environment Environment, extension Extension)
}

Jump to

Keyboard shortcuts

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