Documentation ¶
Overview ¶
Package testutils contains mocks that can be shared across tests for multiple packages
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFiberCaller ¶
NewFiberCaller is a helper function to create an instance of Fiber caller in the test cases so the test cases are easier to read.
func NewHTTPFiberRequest ¶
NewHTTPFiberRequest create new http fiber request based on header and body
func NewUPIFiberRequest ¶
func NewUPIFiberRequest(t testing.TB, header map[string]string, request *upiv1.PredictValuesRequest) fiber.Request
NewUPIFiberRequest create new grpc fiber request based on header and upi request
Types ¶
type MockExperimentRunner ¶
type MockExperimentRunner struct { *runner.Treatment // If WantErr is true, GetTreatmentForRequest() will return a non-nil error WantErr bool // If WantTimeout is true, GetTreatmentForRequest() will wait for the duration of // Timeout and return a non-nil error WantTimeout bool // Timeout to wait for Timeout time.Duration }
MockExperimentRunner is a mock implementation for the Planner interface
func (MockExperimentRunner) GetTreatmentForRequest ¶
func (mp MockExperimentRunner) GetTreatmentForRequest( http.Header, []byte, runner.GetTreatmentOptions, ) (*runner.Treatment, error)
GetTreatmentForRequest returns the experiment treatment provided when MockExperimentRunner is initialized with TestTreatment. If MockExperimentRunner.WantErr is true, GetTreatmentForRequest will return error.
func (MockExperimentRunner) RegisterMetricsCollector ¶
func (mp MockExperimentRunner) RegisterMetricsCollector( _ metrics.Collector, _ runner.MetricsRegistrationHelper, ) error