templatestests

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnotherTestInterface added in v1.1.10

type AnotherTestInterface interface {
	F(ctx context.Context, a1 string, a2 ...string) (result1, result2 string, err error)
	NoError(string) string
	NoParamsOrResults()
	Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)
}

AnotherTestInterface is used to test templates where TestInterface was already used

type AnotherTestInterfaceWithPrometheus added in v1.1.10

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

AnotherTestInterfaceWithPrometheus implements AnotherTestInterface interface with all methods wrapped with Prometheus metrics

func NewAnotherTestInterfaceWithPrometheus added in v1.1.10

func NewAnotherTestInterfaceWithPrometheus(base AnotherTestInterface, instanceName string) AnotherTestInterfaceWithPrometheus

NewAnotherTestInterfaceWithPrometheus returns an instance of the AnotherTestInterface decorated with prometheus summary metric

func (AnotherTestInterfaceWithPrometheus) Channels added in v1.1.10

func (_d AnotherTestInterfaceWithPrometheus) Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)

Channels implements AnotherTestInterface

func (AnotherTestInterfaceWithPrometheus) F added in v1.1.10

func (_d AnotherTestInterfaceWithPrometheus) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements AnotherTestInterface

func (AnotherTestInterfaceWithPrometheus) NoError added in v1.1.10

func (_d AnotherTestInterfaceWithPrometheus) NoError(s1 string) (s2 string)

NoError implements AnotherTestInterface

func (AnotherTestInterfaceWithPrometheus) NoParamsOrResults added in v1.1.10

func (_d AnotherTestInterfaceWithPrometheus) NoParamsOrResults()

NoParamsOrResults implements AnotherTestInterface

type InterfaceWithTwirpErrorWithTwirpError added in v1.1.10

type InterfaceWithTwirpErrorWithTwirpError struct {
	InterfaceWithTwirpError
}

InterfaceWithTwirpErrorWithTwirpError implements InterfaceWithTwirpError interface instrumented such that the request data is injected into twirp.Error as metadata

func NewInterfaceWithTwirpErrorWithTwirpError added in v1.1.10

func NewInterfaceWithTwirpErrorWithTwirpError(base InterfaceWithTwirpError) InterfaceWithTwirpErrorWithTwirpError

NewInterfaceWithTwirpErrorWithTwirpError returns InterfaceWithTwirpErrorWithTwirpError

func (InterfaceWithTwirpErrorWithTwirpError) Method added in v1.1.10

func (_d InterfaceWithTwirpErrorWithTwirpError) Method(ctx context.Context, r *MethodRequest) (mp1 *MethodResponse, err error)

Method implements InterfaceWithTwirpError

type InterfaceWithValidtableArgWithGRPCValidation added in v1.1.8

type InterfaceWithValidtableArgWithGRPCValidation struct {
	InterfaceWithValidtableArg
}

InterfaceWithValidtableArgWithGRPCValidation implements InterfaceWithValidtableArg interface instrumented with GRPC request validation

func NewInterfaceWithValidtableArgWithGRPCValidation added in v1.1.8

func NewInterfaceWithValidtableArgWithGRPCValidation(base InterfaceWithValidtableArg) InterfaceWithValidtableArgWithGRPCValidation

NewInterfaceWithValidtableArgWithGRPCValidation returns InterfaceWithValidtableArgWithGRPCValidation

func (InterfaceWithValidtableArgWithGRPCValidation) Method added in v1.1.8

func (_d InterfaceWithValidtableArgWithGRPCValidation) Method(ctx context.Context, r *ValidatableRequest) (err error)

Method implements InterfaceWithValidtableArg

type InterfaceWithValidtableArgWithTwirpValidation added in v1.1.8

type InterfaceWithValidtableArgWithTwirpValidation struct {
	InterfaceWithValidtableArg
}

InterfaceWithValidtableArgWithTwirpValidation implements InterfaceWithValidtableArg interface instrumented with arguments validation

func NewInterfaceWithValidtableArgWithTwirpValidation added in v1.1.8

func NewInterfaceWithValidtableArgWithTwirpValidation(base InterfaceWithValidtableArg) InterfaceWithValidtableArgWithTwirpValidation

NewInterfaceWithValidtableArgWithTwirpValidation returns InterfaceWithValidtableArgWithTwirpValidation

func (InterfaceWithValidtableArgWithTwirpValidation) Method added in v1.1.8

func (_d InterfaceWithValidtableArgWithTwirpValidation) Method(ctx context.Context, r *ValidatableRequest) (err error)

Method implements InterfaceWithValidtableArg

type InterfaceWithValidtableArgWithValidation added in v1.1.8

type InterfaceWithValidtableArgWithValidation struct {
	InterfaceWithValidtableArg
}

InterfaceWithValidtableArgWithValidation implements InterfaceWithValidtableArg interface instrumented with arguments validation

func NewInterfaceWithValidtableArgWithValidation added in v1.1.8

func NewInterfaceWithValidtableArgWithValidation(base InterfaceWithValidtableArg) InterfaceWithValidtableArgWithValidation

NewInterfaceWithValidtableArgWithValidation returns InterfaceWithValidtableArgWithValidation

func (InterfaceWithValidtableArgWithValidation) Method added in v1.1.8

func (_d InterfaceWithValidtableArgWithValidation) Method(ctx context.Context, r *ValidatableRequest) (err error)

Method implements InterfaceWithValidtableArg

type TestInterface

type TestInterface interface {
	F(ctx context.Context, a1 string, a2 ...string) (result1, result2 string, err error)
	ContextNoError(ctx context.Context, a1 string, a2 string)
	NoError(string) string
	NoParamsOrResults()
	Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)
}

TestInterface is used to test templates

type TestInterfaceAPMTracing added in v1.3.0

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

TestInterfaceAPMTracing implements TestInterface interface with all methods wrapped with go.elastic.co/apm/v2

func NewTestInterfaceAPMTracing added in v1.3.0

func NewTestInterfaceAPMTracing(base TestInterface, opts ...TestInterfaceAPMTracingOption) TestInterfaceAPMTracing

NewTestInterfaceAPMTracing returns an instance of the TestInterface decorated with go.elastic.co/apm/v2

func (TestInterfaceAPMTracing) ContextNoError added in v1.3.0

func (_d TestInterfaceAPMTracing) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfaceAPMTracing) F added in v1.3.0

func (_d TestInterfaceAPMTracing) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

type TestInterfaceAPMTracingOption added in v1.3.0

type TestInterfaceAPMTracingOption func(v *TestInterfaceAPMTracing)

func TestInterfaceAPMTracingWithSpanType added in v1.3.0

func TestInterfaceAPMTracingWithSpanType(spanType string) TestInterfaceAPMTracingOption

func TestInterfaceAPMTracingWithUsingSetLabel added in v1.3.0

func TestInterfaceAPMTracingWithUsingSetLabel() TestInterfaceAPMTracingOption

type TestInterfacePool

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

TestInterfacePool implements TestInterface that uses pool of TestInterface

func NewTestInterfacePool

func NewTestInterfacePool(impls ...TestInterface) TestInterfacePool

NewTestInterfacePool takes several implementations of the TestInterface and returns an instance of the TestInterface that uses sync.Pool of given implemetations

func (TestInterfacePool) Channels added in v1.1.8

func (_d TestInterfacePool) Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)

Channels implements TestInterface

func (TestInterfacePool) ContextNoError added in v1.3.0

func (_d TestInterfacePool) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfacePool) F

func (_d TestInterfacePool) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

func (TestInterfacePool) NoError

func (_d TestInterfacePool) NoError(s1 string) (s2 string)

NoError implements TestInterface

func (TestInterfacePool) NoParamsOrResults

func (_d TestInterfacePool) NoParamsOrResults()

NoParamsOrResults implements TestInterface

type TestInterfaceRoundRobinPool

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

TestInterfaceRoundRobinPool implements TestInterface that uses pool of TestInterface

func MustNewTestInterfaceRoundRobinPool

func MustNewTestInterfaceRoundRobinPool(pool ...TestInterface) *TestInterfaceRoundRobinPool

MustNewTestInterfaceRoundRobinPool takes several implementations of the TestInterface and returns an instance of the TestInterface that picks one of the given implementations using Round-robin algorithm and delegates method call to it.

func NewTestInterfaceRoundRobinPool

func NewTestInterfaceRoundRobinPool(pool ...TestInterface) (*TestInterfaceRoundRobinPool, error)

NewTestInterfaceRoundRobinPool takes several implementations of the TestInterface and returns an instance of the TestInterface that picks one of the given implementations using Round-robin algorithm and delegates method call to it

func (*TestInterfaceRoundRobinPool) Channels added in v1.1.8

func (_d *TestInterfaceRoundRobinPool) Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)

Channels implements TestInterface

func (*TestInterfaceRoundRobinPool) ContextNoError added in v1.3.0

func (_d *TestInterfaceRoundRobinPool) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (*TestInterfaceRoundRobinPool) F

func (_d *TestInterfaceRoundRobinPool) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

func (*TestInterfaceRoundRobinPool) NoError

func (_d *TestInterfaceRoundRobinPool) NoError(s1 string) (s2 string)

NoError implements TestInterface

func (*TestInterfaceRoundRobinPool) NoParamsOrResults

func (_d *TestInterfaceRoundRobinPool) NoParamsOrResults()

NoParamsOrResults implements TestInterface

type TestInterfaceWithCircuitBreaker

type TestInterfaceWithCircuitBreaker struct {
	TestInterface
	// contains filtered or unexported fields
}

TestInterfaceWithCircuitBreaker implements TestInterface instrumented with circuit breaker

func NewTestInterfaceWithCircuitBreaker

func NewTestInterfaceWithCircuitBreaker(base TestInterface, consecutiveErrors int, openInterval time.Duration, ignoreErrors ...error) *TestInterfaceWithCircuitBreaker

NewTestInterfaceWithCircuitBreaker breakes a circuit after consecutiveErrors of errors and closes the circuit again after openInterval of time. If, after openInterval, the first method call results in error we open and close again.

func (*TestInterfaceWithCircuitBreaker) F

func (_d *TestInterfaceWithCircuitBreaker) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

type TestInterfaceWithFallback

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

TestInterfaceWithFallback implements TestInterface interface wrapped with Prometheus metrics

func NewTestInterfaceWithFallback

func NewTestInterfaceWithFallback(interval time.Duration, impls ...TestInterface) TestInterfaceWithFallback

NewTestInterfaceWithFallback takes several implementations of the TestInterface and returns an instance of TestInterface which calls all implementations concurrently with given interval and returns first non-error response.

func (TestInterfaceWithFallback) Channels added in v1.1.8

func (_d TestInterfaceWithFallback) Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)

Channels implements TestInterface

func (TestInterfaceWithFallback) ContextNoError added in v1.3.0

func (_d TestInterfaceWithFallback) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfaceWithFallback) F

func (_d TestInterfaceWithFallback) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

func (TestInterfaceWithFallback) NoError

func (_d TestInterfaceWithFallback) NoError(s1 string) (s2 string)

NoError implements TestInterface

func (TestInterfaceWithFallback) NoParamsOrResults

func (_d TestInterfaceWithFallback) NoParamsOrResults()

NoParamsOrResults implements TestInterface

type TestInterfaceWithLogger

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

TestInterfaceWithLogger implements TestInterface that is instrumented with logging

func NewTestInterfaceWithLogger

func NewTestInterfaceWithLogger(base TestInterface, stdout, stderr io.Writer) TestInterfaceWithLogger

NewTestInterfaceWithLogger instruments an implementation of the TestInterface with simple logging

func (TestInterfaceWithLogger) Channels added in v1.1.8

func (_d TestInterfaceWithLogger) Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)

Channels implements TestInterface

func (TestInterfaceWithLogger) ContextNoError added in v1.3.0

func (_d TestInterfaceWithLogger) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfaceWithLogger) F

func (_d TestInterfaceWithLogger) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

func (TestInterfaceWithLogger) NoError

func (_d TestInterfaceWithLogger) NoError(s1 string) (s2 string)

NoError implements TestInterface

func (TestInterfaceWithLogger) NoParamsOrResults

func (_d TestInterfaceWithLogger) NoParamsOrResults()

NoParamsOrResults implements TestInterface

type TestInterfaceWithLogrus

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

TestInterfaceWithLogrus implements TestInterface that is instrumented with logrus logger

func NewTestInterfaceWithLogrus

func NewTestInterfaceWithLogrus(base TestInterface, log *logrus.Entry) TestInterfaceWithLogrus

NewTestInterfaceWithLogrus instruments an implementation of the TestInterface with simple logging

func (TestInterfaceWithLogrus) Channels added in v1.1.8

func (_d TestInterfaceWithLogrus) Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)

Channels implements TestInterface

func (TestInterfaceWithLogrus) ContextNoError added in v1.3.0

func (_d TestInterfaceWithLogrus) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfaceWithLogrus) F

func (_d TestInterfaceWithLogrus) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

func (TestInterfaceWithLogrus) NoError

func (_d TestInterfaceWithLogrus) NoError(s1 string) (s2 string)

NoError implements TestInterface

func (TestInterfaceWithLogrus) NoParamsOrResults

func (_d TestInterfaceWithLogrus) NoParamsOrResults()

NoParamsOrResults implements TestInterface

type TestInterfaceWithOpenCensus added in v1.1.13

type TestInterfaceWithOpenCensus struct {
	TestInterface
	// contains filtered or unexported fields
}

TestInterfaceWithOpenCensus implements TestInterface interface instrumented with opentracing spans

func NewTestInterfaceWithOpenCensus added in v1.1.13

func NewTestInterfaceWithOpenCensus(base TestInterface, instance string, spanDecorator ...func(span *trace.Span, params, results map[string]interface{})) TestInterfaceWithOpenCensus

NewTestInterfaceWithOpenCensus returns TestInterfaceWithOpenCensus

func (TestInterfaceWithOpenCensus) ContextNoError added in v1.3.0

func (_d TestInterfaceWithOpenCensus) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfaceWithOpenCensus) F added in v1.1.13

func (_d TestInterfaceWithOpenCensus) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

type TestInterfaceWithPrometheus

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

TestInterfaceWithPrometheus implements TestInterface interface with all methods wrapped with Prometheus metrics

func NewTestInterfaceWithPrometheus

func NewTestInterfaceWithPrometheus(base TestInterface, instanceName string) TestInterfaceWithPrometheus

NewTestInterfaceWithPrometheus returns an instance of the TestInterface decorated with prometheus summary metric

func (TestInterfaceWithPrometheus) Channels added in v1.1.8

func (_d TestInterfaceWithPrometheus) Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)

Channels implements TestInterface

func (TestInterfaceWithPrometheus) ContextNoError added in v1.3.0

func (_d TestInterfaceWithPrometheus) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfaceWithPrometheus) F

func (_d TestInterfaceWithPrometheus) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

func (TestInterfaceWithPrometheus) NoError

func (_d TestInterfaceWithPrometheus) NoError(s1 string) (s2 string)

NoError implements TestInterface

func (TestInterfaceWithPrometheus) NoParamsOrResults

func (_d TestInterfaceWithPrometheus) NoParamsOrResults()

NoParamsOrResults implements TestInterface

type TestInterfaceWithRateLimit

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

TestInterfaceWithRateLimit implements TestInterface

func NewTestInterfaceWithRateLimit

func NewTestInterfaceWithRateLimit(base TestInterface, burst int, rps float64) *TestInterfaceWithRateLimit

NewTestInterfaceWithRateLimit instruments an implementation of the TestInterface with rate limiting

func (*TestInterfaceWithRateLimit) Channels added in v1.1.8

func (_d *TestInterfaceWithRateLimit) Channels(chA chan bool, chB chan<- bool, chanC <-chan bool)

Channels implements TestInterface

func (*TestInterfaceWithRateLimit) ContextNoError added in v1.3.0

func (_d *TestInterfaceWithRateLimit) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (*TestInterfaceWithRateLimit) F

func (_d *TestInterfaceWithRateLimit) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

func (*TestInterfaceWithRateLimit) NoError

func (_d *TestInterfaceWithRateLimit) NoError(s1 string) (s2 string)

NoError implements TestInterface

func (*TestInterfaceWithRateLimit) NoParamsOrResults

func (_d *TestInterfaceWithRateLimit) NoParamsOrResults()

NoParamsOrResults implements TestInterface

type TestInterfaceWithRetry

type TestInterfaceWithRetry struct {
	TestInterface
	// contains filtered or unexported fields
}

TestInterfaceWithRetry implements TestInterface interface instrumented with retries

func NewTestInterfaceWithRetry

func NewTestInterfaceWithRetry(base TestInterface, retryCount int, retryInterval time.Duration) TestInterfaceWithRetry

NewTestInterfaceWithRetry returns TestInterfaceWithRetry

func (TestInterfaceWithRetry) F

func (_d TestInterfaceWithRetry) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

type TestInterfaceWithTimeout added in v1.1.8

type TestInterfaceWithTimeout struct {
	TestInterface
	// contains filtered or unexported fields
}

TestInterfaceWithTimeout implements TestInterface interface instrumented with timeouts

func NewTestInterfaceWithTimeout added in v1.1.8

func NewTestInterfaceWithTimeout(base TestInterface, config TestInterfaceWithTimeoutConfig) TestInterfaceWithTimeout

NewTestInterfaceWithTimeout returns TestInterfaceWithTimeout

func (TestInterfaceWithTimeout) ContextNoError added in v1.3.0

func (_d TestInterfaceWithTimeout) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfaceWithTimeout) F added in v1.1.8

func (_d TestInterfaceWithTimeout) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

type TestInterfaceWithTimeoutConfig added in v1.1.8

type TestInterfaceWithTimeoutConfig struct {
	ContextNoErrorTimeout time.Duration

	FTimeout time.Duration
}

type TestInterfaceWithTracing

type TestInterfaceWithTracing struct {
	TestInterface
	// contains filtered or unexported fields
}

TestInterfaceWithTracing implements TestInterface interface instrumented with opentracing spans

func NewTestInterfaceWithTracing

func NewTestInterfaceWithTracing(base TestInterface, instance string, spanDecorator ...func(span opentracing.Span, params, results map[string]interface{})) TestInterfaceWithTracing

NewTestInterfaceWithTracing returns TestInterfaceWithTracing

func (TestInterfaceWithTracing) ContextNoError added in v1.3.0

func (_d TestInterfaceWithTracing) ContextNoError(ctx context.Context, a1 string, a2 string)

ContextNoError implements TestInterface

func (TestInterfaceWithTracing) F

func (_d TestInterfaceWithTracing) F(ctx context.Context, a1 string, a2 ...string) (result1 string, result2 string, err error)

F implements TestInterface

Jump to

Keyboard shortcuts

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