mock

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircuitError

type CircuitError struct {
	Message             string
	ConcurrencyExceeded bool
	CircuitOpened       bool
}

CircuitError implements the circuit.Error interface for tests

func (CircuitError) CircuitOpen

func (mce CircuitError) CircuitOpen() bool

CircuitOpen returns whether the circuit is open for Circuit Error structs

func (CircuitError) ConcurrencyLimitReached

func (mce CircuitError) ConcurrencyLimitReached() bool

ConcurrencyLimitReached returns whether the concurrency limit has been reached for Circuit Error structs

func (CircuitError) Error

func (mce CircuitError) Error() string

Error returns the error message for Circuit Error structs

type RoundTripper

type RoundTripper struct {
	ResponseStatusCodes []int
	CreateErr           bool
	CallNumber          int
	// Optional, if specified raise this error type, otherwise a standard error is returned
	DesiredErr error
}

This roundtripper is a noop and is intended for use only within tests.

func (*RoundTripper) RoundTrip

func (mockRT *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip Performs a "noop" round trip. It is intended for use only within tests.

Jump to

Keyboard shortcuts

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