Documentation ¶
Index ¶
- type HTTPServerMock
- type HealthCheckerMock
- func (mock *HealthCheckerMock) AddCheck(name string, checker healthcheck.Checker) error
- func (mock *HealthCheckerMock) AddCheckCalls() []struct{ ... }
- func (mock *HealthCheckerMock) Handler(w http.ResponseWriter, req *http.Request)
- func (mock *HealthCheckerMock) HandlerCalls() []struct{ ... }
- func (mock *HealthCheckerMock) Start(ctx context.Context)
- func (mock *HealthCheckerMock) StartCalls() []struct{ ... }
- func (mock *HealthCheckerMock) Stop()
- func (mock *HealthCheckerMock) StopCalls() []struct{}
- type InitialiserMock
- func (mock *InitialiserMock) DoGetFilesService(ctx context.Context, cfg *config.Config) file.FilesService
- func (mock *InitialiserMock) DoGetFilesServiceCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetHTTPServer(bindAddr string, router http.Handler) service.HTTPServer
- func (mock *InitialiserMock) DoGetHTTPServerCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetHealthCheck(cfg *config.Config, buildTime string, gitCommit string, version string) (service.HealthChecker, error)
- func (mock *InitialiserMock) DoGetHealthCheckCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetImageAPIClient(cfg *config.Config) event.ImageAPIClient
- func (mock *InitialiserMock) DoGetImageAPIClientCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetKafkaFilePublishedConsumer(ctx context.Context, cfg *config.Config) (service.KafkaConsumer, error)
- func (mock *InitialiserMock) DoGetKafkaFilePublishedConsumerCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetKafkaImagePublishedConsumer(ctx context.Context, cfg *config.Config) (service.KafkaConsumer, error)
- func (mock *InitialiserMock) DoGetKafkaImagePublishedConsumerCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetS3Client(awsRegion string, bucketName string) (file.S3Client, error)
- func (mock *InitialiserMock) DoGetS3ClientCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetS3ClientWithSession(bucketName string, s *session.Session) (file.S3Client, error)
- func (mock *InitialiserMock) DoGetS3ClientWithSessionCalls() []struct{ ... }
- type KafkaConsumerMock
- func (mock *KafkaConsumerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (mock *KafkaConsumerMock) CheckerCalls() []struct{ ... }
- func (mock *KafkaConsumerMock) Close(ctx context.Context) error
- func (mock *KafkaConsumerMock) CloseCalls() []struct{ ... }
- func (mock *KafkaConsumerMock) RegisterBatchHandler(ctx context.Context, batchHandler kafka.BatchHandler) error
- func (mock *KafkaConsumerMock) RegisterBatchHandlerCalls() []struct{ ... }
- func (mock *KafkaConsumerMock) Start() error
- func (mock *KafkaConsumerMock) StartCalls() []struct{}
- func (mock *KafkaConsumerMock) StateWait(state kafka.State)
- func (mock *KafkaConsumerMock) StateWaitCalls() []struct{ ... }
- func (mock *KafkaConsumerMock) Stop() error
- func (mock *KafkaConsumerMock) StopCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPServerMock ¶
type HTTPServerMock struct { // ListenAndServeFunc mocks the ListenAndServe method. ListenAndServeFunc func() error // ShutdownFunc mocks the Shutdown method. ShutdownFunc func(ctx context.Context) error // contains filtered or unexported fields }
HTTPServerMock is a mock implementation of service.HTTPServer.
func TestSomethingThatUsesHTTPServer(t *testing.T) { // make and configure a mocked service.HTTPServer mockedHTTPServer := &HTTPServerMock{ ListenAndServeFunc: func() error { panic("mock out the ListenAndServe method") }, ShutdownFunc: func(ctx context.Context) error { panic("mock out the Shutdown method") }, } // use mockedHTTPServer in code that requires service.HTTPServer // and then make assertions. }
func (*HTTPServerMock) ListenAndServe ¶
func (mock *HTTPServerMock) ListenAndServe() error
ListenAndServe calls ListenAndServeFunc.
func (*HTTPServerMock) ListenAndServeCalls ¶
func (mock *HTTPServerMock) ListenAndServeCalls() []struct { }
ListenAndServeCalls gets all the calls that were made to ListenAndServe. Check the length with:
len(mockedHTTPServer.ListenAndServeCalls())
func (*HTTPServerMock) Shutdown ¶
func (mock *HTTPServerMock) Shutdown(ctx context.Context) error
Shutdown calls ShutdownFunc.
func (*HTTPServerMock) ShutdownCalls ¶
func (mock *HTTPServerMock) ShutdownCalls() []struct { Ctx context.Context }
ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:
len(mockedHTTPServer.ShutdownCalls())
type HealthCheckerMock ¶
type HealthCheckerMock struct { // AddCheckFunc mocks the AddCheck method. AddCheckFunc func(name string, checker healthcheck.Checker) error // HandlerFunc mocks the Handler method. HandlerFunc func(w http.ResponseWriter, req *http.Request) // StartFunc mocks the Start method. StartFunc func(ctx context.Context) // StopFunc mocks the Stop method. StopFunc func() // contains filtered or unexported fields }
HealthCheckerMock is a mock implementation of service.HealthChecker.
func TestSomethingThatUsesHealthChecker(t *testing.T) { // make and configure a mocked service.HealthChecker mockedHealthChecker := &HealthCheckerMock{ AddCheckFunc: func(name string, checker healthcheck.Checker) error { panic("mock out the AddCheck method") }, HandlerFunc: func(w http.ResponseWriter, req *http.Request) { panic("mock out the Handler method") }, StartFunc: func(ctx context.Context) { panic("mock out the Start method") }, StopFunc: func() { panic("mock out the Stop method") }, } // use mockedHealthChecker in code that requires service.HealthChecker // and then make assertions. }
func (*HealthCheckerMock) AddCheck ¶
func (mock *HealthCheckerMock) AddCheck(name string, checker healthcheck.Checker) error
AddCheck calls AddCheckFunc.
func (*HealthCheckerMock) AddCheckCalls ¶
func (mock *HealthCheckerMock) AddCheckCalls() []struct { Name string Checker healthcheck.Checker }
AddCheckCalls gets all the calls that were made to AddCheck. Check the length with:
len(mockedHealthChecker.AddCheckCalls())
func (*HealthCheckerMock) Handler ¶
func (mock *HealthCheckerMock) Handler(w http.ResponseWriter, req *http.Request)
Handler calls HandlerFunc.
func (*HealthCheckerMock) HandlerCalls ¶
func (mock *HealthCheckerMock) HandlerCalls() []struct { W http.ResponseWriter Req *http.Request }
HandlerCalls gets all the calls that were made to Handler. Check the length with:
len(mockedHealthChecker.HandlerCalls())
func (*HealthCheckerMock) Start ¶
func (mock *HealthCheckerMock) Start(ctx context.Context)
Start calls StartFunc.
func (*HealthCheckerMock) StartCalls ¶
func (mock *HealthCheckerMock) StartCalls() []struct { Ctx context.Context }
StartCalls gets all the calls that were made to Start. Check the length with:
len(mockedHealthChecker.StartCalls())
func (*HealthCheckerMock) StopCalls ¶
func (mock *HealthCheckerMock) StopCalls() []struct { }
StopCalls gets all the calls that were made to Stop. Check the length with:
len(mockedHealthChecker.StopCalls())
type InitialiserMock ¶
type InitialiserMock struct { // DoGetFilesServiceFunc mocks the DoGetFilesService method. DoGetFilesServiceFunc func(ctx context.Context, cfg *config.Config) file.FilesService // DoGetHTTPServerFunc mocks the DoGetHTTPServer method. DoGetHTTPServerFunc func(bindAddr string, router http.Handler) service.HTTPServer // DoGetHealthCheckFunc mocks the DoGetHealthCheck method. DoGetHealthCheckFunc func(cfg *config.Config, buildTime string, gitCommit string, version string) (service.HealthChecker, error) // DoGetImageAPIClientFunc mocks the DoGetImageAPIClient method. DoGetImageAPIClientFunc func(cfg *config.Config) event.ImageAPIClient // DoGetKafkaFilePublishedConsumerFunc mocks the DoGetKafkaFilePublishedConsumer method. DoGetKafkaFilePublishedConsumerFunc func(ctx context.Context, cfg *config.Config) (service.KafkaConsumer, error) // DoGetKafkaImagePublishedConsumerFunc mocks the DoGetKafkaImagePublishedConsumer method. DoGetKafkaImagePublishedConsumerFunc func(ctx context.Context, cfg *config.Config) (service.KafkaConsumer, error) // DoGetS3ClientFunc mocks the DoGetS3Client method. DoGetS3ClientFunc func(awsRegion string, bucketName string) (file.S3Client, error) // DoGetS3ClientWithSessionFunc mocks the DoGetS3ClientWithSession method. DoGetS3ClientWithSessionFunc func(bucketName string, s *session.Session) (file.S3Client, error) // contains filtered or unexported fields }
InitialiserMock is a mock implementation of service.Initialiser.
func TestSomethingThatUsesInitialiser(t *testing.T) { // make and configure a mocked service.Initialiser mockedInitialiser := &InitialiserMock{ DoGetFilesServiceFunc: func(ctx context.Context, cfg *config.Config) file.FilesService { panic("mock out the DoGetFilesService method") }, DoGetHTTPServerFunc: func(bindAddr string, router http.Handler) service.HTTPServer { panic("mock out the DoGetHTTPServer method") }, DoGetHealthCheckFunc: func(cfg *config.Config, buildTime string, gitCommit string, version string) (service.HealthChecker, error) { panic("mock out the DoGetHealthCheck method") }, DoGetImageAPIClientFunc: func(cfg *config.Config) event.ImageAPIClient { panic("mock out the DoGetImageAPIClient method") }, DoGetKafkaFilePublishedConsumerFunc: func(ctx context.Context, cfg *config.Config) (service.KafkaConsumer, error) { panic("mock out the DoGetKafkaFilePublishedConsumer method") }, DoGetKafkaImagePublishedConsumerFunc: func(ctx context.Context, cfg *config.Config) (service.KafkaConsumer, error) { panic("mock out the DoGetKafkaImagePublishedConsumer method") }, DoGetS3ClientFunc: func(awsRegion string, bucketName string) (file.S3Client, error) { panic("mock out the DoGetS3Client method") }, DoGetS3ClientWithSessionFunc: func(bucketName string, s *session.Session) (file.S3Client, error) { panic("mock out the DoGetS3ClientWithSession method") }, } // use mockedInitialiser in code that requires service.Initialiser // and then make assertions. }
func (*InitialiserMock) DoGetFilesService ¶ added in v1.3.0
func (mock *InitialiserMock) DoGetFilesService(ctx context.Context, cfg *config.Config) file.FilesService
DoGetFilesService calls DoGetFilesServiceFunc.
func (*InitialiserMock) DoGetFilesServiceCalls ¶ added in v1.3.0
func (mock *InitialiserMock) DoGetFilesServiceCalls() []struct { Ctx context.Context Cfg *config.Config }
DoGetFilesServiceCalls gets all the calls that were made to DoGetFilesService. Check the length with:
len(mockedInitialiser.DoGetFilesServiceCalls())
func (*InitialiserMock) DoGetHTTPServer ¶
func (mock *InitialiserMock) DoGetHTTPServer(bindAddr string, router http.Handler) service.HTTPServer
DoGetHTTPServer calls DoGetHTTPServerFunc.
func (*InitialiserMock) DoGetHTTPServerCalls ¶
func (mock *InitialiserMock) DoGetHTTPServerCalls() []struct { BindAddr string Router http.Handler }
DoGetHTTPServerCalls gets all the calls that were made to DoGetHTTPServer. Check the length with:
len(mockedInitialiser.DoGetHTTPServerCalls())
func (*InitialiserMock) DoGetHealthCheck ¶
func (mock *InitialiserMock) DoGetHealthCheck(cfg *config.Config, buildTime string, gitCommit string, version string) (service.HealthChecker, error)
DoGetHealthCheck calls DoGetHealthCheckFunc.
func (*InitialiserMock) DoGetHealthCheckCalls ¶
func (mock *InitialiserMock) DoGetHealthCheckCalls() []struct { Cfg *config.Config BuildTime string GitCommit string Version string }
DoGetHealthCheckCalls gets all the calls that were made to DoGetHealthCheck. Check the length with:
len(mockedInitialiser.DoGetHealthCheckCalls())
func (*InitialiserMock) DoGetImageAPIClient ¶ added in v0.3.0
func (mock *InitialiserMock) DoGetImageAPIClient(cfg *config.Config) event.ImageAPIClient
DoGetImageAPIClient calls DoGetImageAPIClientFunc.
func (*InitialiserMock) DoGetImageAPIClientCalls ¶ added in v0.3.0
func (mock *InitialiserMock) DoGetImageAPIClientCalls() []struct { Cfg *config.Config }
DoGetImageAPIClientCalls gets all the calls that were made to DoGetImageAPIClient. Check the length with:
len(mockedInitialiser.DoGetImageAPIClientCalls())
func (*InitialiserMock) DoGetKafkaFilePublishedConsumer ¶ added in v1.3.0
func (mock *InitialiserMock) DoGetKafkaFilePublishedConsumer(ctx context.Context, cfg *config.Config) (service.KafkaConsumer, error)
DoGetKafkaFilePublishedConsumer calls DoGetKafkaFilePublishedConsumerFunc.
func (*InitialiserMock) DoGetKafkaFilePublishedConsumerCalls ¶ added in v1.3.0
func (mock *InitialiserMock) DoGetKafkaFilePublishedConsumerCalls() []struct { Ctx context.Context Cfg *config.Config }
DoGetKafkaFilePublishedConsumerCalls gets all the calls that were made to DoGetKafkaFilePublishedConsumer. Check the length with:
len(mockedInitialiser.DoGetKafkaFilePublishedConsumerCalls())
func (*InitialiserMock) DoGetKafkaImagePublishedConsumer ¶ added in v1.3.0
func (mock *InitialiserMock) DoGetKafkaImagePublishedConsumer(ctx context.Context, cfg *config.Config) (service.KafkaConsumer, error)
DoGetKafkaImagePublishedConsumer calls DoGetKafkaImagePublishedConsumerFunc.
func (*InitialiserMock) DoGetKafkaImagePublishedConsumerCalls ¶ added in v1.3.0
func (mock *InitialiserMock) DoGetKafkaImagePublishedConsumerCalls() []struct { Ctx context.Context Cfg *config.Config }
DoGetKafkaImagePublishedConsumerCalls gets all the calls that were made to DoGetKafkaImagePublishedConsumer. Check the length with:
len(mockedInitialiser.DoGetKafkaImagePublishedConsumerCalls())
func (*InitialiserMock) DoGetS3Client ¶ added in v0.4.0
func (mock *InitialiserMock) DoGetS3Client(awsRegion string, bucketName string) (file.S3Client, error)
DoGetS3Client calls DoGetS3ClientFunc.
func (*InitialiserMock) DoGetS3ClientCalls ¶ added in v0.4.0
func (mock *InitialiserMock) DoGetS3ClientCalls() []struct { AwsRegion string BucketName string }
DoGetS3ClientCalls gets all the calls that were made to DoGetS3Client. Check the length with:
len(mockedInitialiser.DoGetS3ClientCalls())
func (*InitialiserMock) DoGetS3ClientWithSession ¶ added in v0.7.0
func (mock *InitialiserMock) DoGetS3ClientWithSession(bucketName string, s *session.Session) (file.S3Client, error)
DoGetS3ClientWithSession calls DoGetS3ClientWithSessionFunc.
func (*InitialiserMock) DoGetS3ClientWithSessionCalls ¶ added in v0.7.0
func (mock *InitialiserMock) DoGetS3ClientWithSessionCalls() []struct { BucketName string S *session.Session }
DoGetS3ClientWithSessionCalls gets all the calls that were made to DoGetS3ClientWithSession. Check the length with:
len(mockedInitialiser.DoGetS3ClientWithSessionCalls())
type KafkaConsumerMock ¶ added in v0.7.0
type KafkaConsumerMock struct { // CheckerFunc mocks the Checker method. CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error // CloseFunc mocks the Close method. CloseFunc func(ctx context.Context) error // RegisterBatchHandlerFunc mocks the RegisterBatchHandler method. RegisterBatchHandlerFunc func(ctx context.Context, batchHandler kafka.BatchHandler) error // StartFunc mocks the Start method. StartFunc func() error // StateWaitFunc mocks the StateWait method. StateWaitFunc func(state kafka.State) // StopFunc mocks the Stop method. StopFunc func() error // contains filtered or unexported fields }
KafkaConsumerMock is a mock implementation of service.KafkaConsumer.
func TestSomethingThatUsesKafkaConsumer(t *testing.T) { // make and configure a mocked service.KafkaConsumer mockedKafkaConsumer := &KafkaConsumerMock{ CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error { panic("mock out the Checker method") }, CloseFunc: func(ctx context.Context) error { panic("mock out the Close method") }, RegisterBatchHandlerFunc: func(ctx context.Context, batchHandler kafka.BatchHandler) error { panic("mock out the RegisterBatchHandler method") }, StartFunc: func() error { panic("mock out the Start method") }, StateWaitFunc: func(state kafka.State) { panic("mock out the StateWait method") }, StopFunc: func() error { panic("mock out the Stop method") }, } // use mockedKafkaConsumer in code that requires service.KafkaConsumer // and then make assertions. }
func (*KafkaConsumerMock) Checker ¶ added in v0.7.0
func (mock *KafkaConsumerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*KafkaConsumerMock) CheckerCalls ¶ added in v0.7.0
func (mock *KafkaConsumerMock) CheckerCalls() []struct { Ctx context.Context State *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedKafkaConsumer.CheckerCalls())
func (*KafkaConsumerMock) Close ¶ added in v0.7.0
func (mock *KafkaConsumerMock) Close(ctx context.Context) error
Close calls CloseFunc.
func (*KafkaConsumerMock) CloseCalls ¶ added in v0.7.0
func (mock *KafkaConsumerMock) CloseCalls() []struct { Ctx context.Context }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedKafkaConsumer.CloseCalls())
func (*KafkaConsumerMock) RegisterBatchHandler ¶ added in v1.3.0
func (mock *KafkaConsumerMock) RegisterBatchHandler(ctx context.Context, batchHandler kafka.BatchHandler) error
RegisterBatchHandler calls RegisterBatchHandlerFunc.
func (*KafkaConsumerMock) RegisterBatchHandlerCalls ¶ added in v1.3.0
func (mock *KafkaConsumerMock) RegisterBatchHandlerCalls() []struct { Ctx context.Context BatchHandler kafka.BatchHandler }
RegisterBatchHandlerCalls gets all the calls that were made to RegisterBatchHandler. Check the length with:
len(mockedKafkaConsumer.RegisterBatchHandlerCalls())
func (*KafkaConsumerMock) Start ¶ added in v1.3.0
func (mock *KafkaConsumerMock) Start() error
Start calls StartFunc.
func (*KafkaConsumerMock) StartCalls ¶ added in v1.3.0
func (mock *KafkaConsumerMock) StartCalls() []struct { }
StartCalls gets all the calls that were made to Start. Check the length with:
len(mockedKafkaConsumer.StartCalls())
func (*KafkaConsumerMock) StateWait ¶ added in v1.3.0
func (mock *KafkaConsumerMock) StateWait(state kafka.State)
StateWait calls StateWaitFunc.
func (*KafkaConsumerMock) StateWaitCalls ¶ added in v1.3.0
func (mock *KafkaConsumerMock) StateWaitCalls() []struct { State kafka.State }
StateWaitCalls gets all the calls that were made to StateWait. Check the length with:
len(mockedKafkaConsumer.StateWaitCalls())
func (*KafkaConsumerMock) Stop ¶ added in v1.3.0
func (mock *KafkaConsumerMock) Stop() error
Stop calls StopFunc.
func (*KafkaConsumerMock) StopCalls ¶ added in v1.3.0
func (mock *KafkaConsumerMock) StopCalls() []struct { }
StopCalls gets all the calls that were made to Stop. Check the length with:
len(mockedKafkaConsumer.StopCalls())