templatestests

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnotherTestInterface

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

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

AnotherTestInterfaceWithPrometheus implements AnotherTestInterface interface with all methods wrapped with Prometheus metrics

func NewAnotherTestInterfaceWithPrometheus

func NewAnotherTestInterfaceWithPrometheus(base AnotherTestInterface, instanceName string) AnotherTestInterfaceWithPrometheus

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

func (AnotherTestInterfaceWithPrometheus) Channels

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

Channels implements AnotherTestInterface

func (AnotherTestInterfaceWithPrometheus) F

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

F implements AnotherTestInterface

func (AnotherTestInterfaceWithPrometheus) NoError

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

NoError implements AnotherTestInterface

func (AnotherTestInterfaceWithPrometheus) NoParamsOrResults

func (_d AnotherTestInterfaceWithPrometheus) NoParamsOrResults()

NoParamsOrResults implements AnotherTestInterface

type InterfaceWithTwirpErrorWithTwirpError

type InterfaceWithTwirpErrorWithTwirpError struct {
	InterfaceWithTwirpError
}

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

func NewInterfaceWithTwirpErrorWithTwirpError

func NewInterfaceWithTwirpErrorWithTwirpError(base InterfaceWithTwirpError) InterfaceWithTwirpErrorWithTwirpError

NewInterfaceWithTwirpErrorWithTwirpError returns InterfaceWithTwirpErrorWithTwirpError

func (InterfaceWithTwirpErrorWithTwirpError) Method

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

Method implements InterfaceWithTwirpError

type InterfaceWithValidtableArgWithGRPCValidation

type InterfaceWithValidtableArgWithGRPCValidation struct {
	InterfaceWithValidtableArg
}

InterfaceWithValidtableArgWithGRPCValidation implements InterfaceWithValidtableArg interface instrumented with GRPC request validation

func NewInterfaceWithValidtableArgWithGRPCValidation

func NewInterfaceWithValidtableArgWithGRPCValidation(base InterfaceWithValidtableArg) InterfaceWithValidtableArgWithGRPCValidation

NewInterfaceWithValidtableArgWithGRPCValidation returns InterfaceWithValidtableArgWithGRPCValidation

func (InterfaceWithValidtableArgWithGRPCValidation) Method

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

Method implements InterfaceWithValidtableArg

type InterfaceWithValidtableArgWithTwirpValidation

type InterfaceWithValidtableArgWithTwirpValidation struct {
	InterfaceWithValidtableArg
}

InterfaceWithValidtableArgWithTwirpValidation implements InterfaceWithValidtableArg interface instrumented with arguments validation

func NewInterfaceWithValidtableArgWithTwirpValidation

func NewInterfaceWithValidtableArgWithTwirpValidation(base InterfaceWithValidtableArg) InterfaceWithValidtableArgWithTwirpValidation

NewInterfaceWithValidtableArgWithTwirpValidation returns InterfaceWithValidtableArgWithTwirpValidation

func (InterfaceWithValidtableArgWithTwirpValidation) Method

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

Method implements InterfaceWithValidtableArg

type InterfaceWithValidtableArgWithValidation

type InterfaceWithValidtableArgWithValidation struct {
	InterfaceWithValidtableArg
}

InterfaceWithValidtableArgWithValidation implements InterfaceWithValidtableArg interface instrumented with arguments validation

func NewInterfaceWithValidtableArgWithValidation

func NewInterfaceWithValidtableArgWithValidation(base InterfaceWithValidtableArg) InterfaceWithValidtableArgWithValidation

NewInterfaceWithValidtableArgWithValidation returns InterfaceWithValidtableArgWithValidation

func (InterfaceWithValidtableArgWithValidation) Method

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 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

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

Channels implements TestInterface

func (TestInterfacePool) ContextNoError

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

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

Channels implements TestInterface

func (*TestInterfaceRoundRobinPool) ContextNoError

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

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

Channels implements TestInterface

func (TestInterfaceWithFallback) ContextNoError

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

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

Channels implements TestInterface

func (TestInterfaceWithLogger) ContextNoError

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

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

Channels implements TestInterface

func (TestInterfaceWithLogrus) ContextNoError

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

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

TestInterfaceWithOpenCensus implements TestInterface interface instrumented with opentracing spans

func NewTestInterfaceWithOpenCensus

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

NewTestInterfaceWithOpenCensus returns TestInterfaceWithOpenCensus

func (TestInterfaceWithOpenCensus) ContextNoError

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

ContextNoError implements TestInterface

func (TestInterfaceWithOpenCensus) F

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

F implements TestInterface

type TestInterfaceWithOpentelemetry

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

TestInterfaceWithOpentelemetry implements TestInterface interface instrumented with opentracing spans

func NewTestInterfaceWithOpentelemetry

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

NewTestInterfaceWithOpentelemetry returns TestInterfaceWithOpentelemetry

func (TestInterfaceWithOpentelemetry) ContextNoError

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

ContextNoError implements TestInterface

func (TestInterfaceWithOpentelemetry) F

func (_d TestInterfaceWithOpentelemetry) 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

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

Channels implements TestInterface

func (TestInterfaceWithPrometheus) ContextNoError

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

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

Channels implements TestInterface

func (*TestInterfaceWithRateLimit) ContextNoError

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

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

TestInterfaceWithTimeout implements TestInterface interface instrumented with timeouts

func NewTestInterfaceWithTimeout

func NewTestInterfaceWithTimeout(base TestInterface, config TestInterfaceWithTimeoutConfig) TestInterfaceWithTimeout

NewTestInterfaceWithTimeout returns TestInterfaceWithTimeout

func (TestInterfaceWithTimeout) ContextNoError

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

ContextNoError implements TestInterface

func (TestInterfaceWithTimeout) F

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

F implements TestInterface

type TestInterfaceWithTimeoutConfig

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

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