Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAPI ¶
func WithAPI(params *setupParams)
WithAPI is a SetupOption that provides a http.Handler with the Tenso API.
func WithTaskContext ¶
func WithTaskContext(params *setupParams)
WithTaskContext is a SetupOption that provides a tasks.Context object for testing worker tasks.
Types ¶
type Setup ¶
type Setup struct {
// fields that are always set
Clock *mock.Clock
Config tenso.Configuration
DB *gorp.DbMap
Ctx context.Context //nolint: containedctx // only used in tests
Registry *prometheus.Registry
// fields that are set if WithAPI is included
Validator *mock.Validator[*mock.Enforcer]
Handler httptest.Handler
// fields that are set if WithTaskContext is included
TaskContext *tasks.Context
}
Setup contains all the pieces that are needed for most tests.
type SetupOption ¶
type SetupOption func(*setupParams)
SetupOption is an option that can be given to NewSetup().
func WithRoute ¶
func WithRoute(route string) SetupOption
WithRoute is a SetupOption that adds a route to the configuration.
Click to show internal directories.
Click to hide internal directories.