traffic

package
v0.0.0-...-044be69 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Source of the traffic.
	Source echo.Caller

	// Options for generating traffic from the Source to the target.
	Options echo.CallOptions

	// Interval between successive call operations. If not set, defaults to 1 second.
	Interval time.Duration

	// Maximum time to wait for traffic to complete after stopping. If not set, defaults to 15 seconds.
	StopTimeout time.Duration
}

Config for a traffic Generator.

type Generator

type Generator interface {
	// Start sending traffic.
	Start() Generator

	// Stop sending traffic and wait for any in-flight requests to complete.
	// Returns the Result
	Stop() Result
}

Generator of traffic between echo instances. Every time interval (as defined by Config.Interval), a grpc request is sent to the source pod, causing it to send a request to the destination echo server. Results are captured for each request for later processing.

func NewGenerator

func NewGenerator(t test.Failer, cfg Config) Generator

NewGenerator returns a new Generator with the given configuration.

type Result

type Result struct {
	TotalRequests      int
	SuccessfulRequests int
	Error              error
}

Result of a traffic generation operation.

func (Result) CheckSuccessRate

func (r Result) CheckSuccessRate(t test.Failer, minimumPercent float64)

CheckSuccessRate asserts that a minimum success threshold was met.

func (Result) PercentSuccess

func (r Result) PercentSuccess() float64

func (Result) String

func (r Result) String() string

Jump to

Keyboard shortcuts

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