istio: Index | Files

package util

import ""


Package Files

common_utils.go compare_utils.go pilot_server.go retry.go


var (
    // MockPilotGrpcAddr is the address to be used for grpc connections.
    MockPilotGrpcAddr string

    // MockPilotHTTPPort is the dynamic port for pilot http
    MockPilotHTTPPort int

    // MockPilotGrpcPort is the dynamic port for pilot grpc
    MockPilotGrpcPort int

func Backoff Uses

func Backoff(baseDelay, maxDelay time.Duration, retries int) time.Duration

Backoff returns a random value in [0, maxDelay] that increases exponentially with retries, starting from baseDelay. It is the Go equivalent to C++'s //util/time/

func Compare Uses

func Compare(out, model []byte) error

Compare compares two byte slices. It returns an error with a contextual diff if they are not equal.

func RandomString Uses

func RandomString(n int) string

RandomString returns a random string of size n (letters only)

type Break Uses

type Break struct {
    Err error

Break the retry loop if the error returned is of this type.

func (Break) Error Uses

func (e Break) Error() string

type Retrier Uses

type Retrier struct {
    // BaseDelay is the minimum delay between retry attempts.
    BaseDelay time.Duration
    // MaxDelay is the maximum delay allowed between retry attempts.
    MaxDelay time.Duration
    // MaxDuration is the maximum cumulative duration allowed for all retries
    MaxDuration time.Duration
    // Retries defines number of retry attempts
    Retries int

Retrier contains the retry configuration parameters.

func (Retrier) Retry Uses

func (r Retrier) Retry(ctx context.Context, fn func(ctx context.Context, retryIndex int) error) (int, error)

Retry calls the given function a number of times, unless it returns a nil or a Break

type TearDownFunc Uses

type TearDownFunc func()

TearDownFunc is to be called to tear down a test server.

func EnsureTestServer Uses

func EnsureTestServer(args ...func(*bootstrap.PilotArgs)) (*bootstrap.Server, TearDownFunc)

EnsureTestServer will ensure a pilot server is running in process and initializes the MockPilotUrl and MockPilotGrpcAddr to allow connections to the test pilot.

Package util imports 17 packages (graph) and is imported by 3 packages. Updated 2020-06-02. Refresh now. Tools for package owners.