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) DoGetDownloadServiceAPIClient(cfg *config.Config) (storage.DownloadServiceAPIClient, error)
- func (mock *InitialiserMock) DoGetDownloadServiceAPIClientCalls() []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) DoGetHealthClient(name string, url string) *health.Client
- func (mock *InitialiserMock) DoGetHealthClientCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetInteractivesAPIClient(apiRouter *health.Client) (routes.InteractivesAPIClient, error)
- func (mock *InitialiserMock) DoGetInteractivesAPIClientCalls() []struct{ ... }
- func (mock *InitialiserMock) DoGetStorageProvider(cfg *config.Config, c storage.DownloadServiceAPIClient) (storage.Provider, error)
- func (mock *InitialiserMock) DoGetStorageProviderCalls() []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 { // DoGetDownloadServiceAPIClientFunc mocks the DoGetDownloadServiceAPIClient method. DoGetDownloadServiceAPIClientFunc func(cfg *config.Config) (storage.DownloadServiceAPIClient, error) // 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) // DoGetHealthClientFunc mocks the DoGetHealthClient method. DoGetHealthClientFunc func(name string, url string) *health.Client // DoGetInteractivesAPIClientFunc mocks the DoGetInteractivesAPIClient method. DoGetInteractivesAPIClientFunc func(apiRouter *health.Client) (routes.InteractivesAPIClient, error) // DoGetStorageProviderFunc mocks the DoGetStorageProvider method. DoGetStorageProviderFunc func(cfg *config.Config, c storage.DownloadServiceAPIClient) (storage.Provider, 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{ DoGetDownloadServiceAPIClientFunc: func(cfg *config.Config) (storage.DownloadServiceAPIClient, error) { panic("mock out the DoGetDownloadServiceAPIClient 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") }, DoGetHealthClientFunc: func(name string, url string) *health.Client { panic("mock out the DoGetHealthClient method") }, DoGetInteractivesAPIClientFunc: func(apiRouter *health.Client) (routes.InteractivesAPIClient, error) { panic("mock out the DoGetInteractivesAPIClient method") }, DoGetStorageProviderFunc: func(cfg *config.Config, c storage.DownloadServiceAPIClient) (storage.Provider, error) { panic("mock out the DoGetStorageProvider method") }, } // use mockedInitialiser in code that requires service.Initialiser // and then make assertions. }
func (*InitialiserMock) DoGetDownloadServiceAPIClient ¶
func (mock *InitialiserMock) DoGetDownloadServiceAPIClient(cfg *config.Config) (storage.DownloadServiceAPIClient, error)
DoGetDownloadServiceAPIClient calls DoGetDownloadServiceAPIClientFunc.
func (*InitialiserMock) DoGetDownloadServiceAPIClientCalls ¶
func (mock *InitialiserMock) DoGetDownloadServiceAPIClientCalls() []struct { Cfg *config.Config }
DoGetDownloadServiceAPIClientCalls gets all the calls that were made to DoGetDownloadServiceAPIClient. Check the length with:
len(mockedInitialiser.DoGetDownloadServiceAPIClientCalls())
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) DoGetHealthClient ¶
func (mock *InitialiserMock) DoGetHealthClient(name string, url string) *health.Client
DoGetHealthClient calls DoGetHealthClientFunc.
func (*InitialiserMock) DoGetHealthClientCalls ¶
func (mock *InitialiserMock) DoGetHealthClientCalls() []struct { Name string URL string }
DoGetHealthClientCalls gets all the calls that were made to DoGetHealthClient. Check the length with:
len(mockedInitialiser.DoGetHealthClientCalls())
func (*InitialiserMock) DoGetInteractivesAPIClient ¶
func (mock *InitialiserMock) DoGetInteractivesAPIClient(apiRouter *health.Client) (routes.InteractivesAPIClient, error)
DoGetInteractivesAPIClient calls DoGetInteractivesAPIClientFunc.
func (*InitialiserMock) DoGetInteractivesAPIClientCalls ¶
func (mock *InitialiserMock) DoGetInteractivesAPIClientCalls() []struct { ApiRouter *health.Client }
DoGetInteractivesAPIClientCalls gets all the calls that were made to DoGetInteractivesAPIClient. Check the length with:
len(mockedInitialiser.DoGetInteractivesAPIClientCalls())
func (*InitialiserMock) DoGetStorageProvider ¶
func (mock *InitialiserMock) DoGetStorageProvider(cfg *config.Config, c storage.DownloadServiceAPIClient) (storage.Provider, error)
DoGetStorageProvider calls DoGetStorageProviderFunc.
func (*InitialiserMock) DoGetStorageProviderCalls ¶
func (mock *InitialiserMock) DoGetStorageProviderCalls() []struct { Cfg *config.Config C storage.DownloadServiceAPIClient }
DoGetStorageProviderCalls gets all the calls that were made to DoGetStorageProvider. Check the length with:
len(mockedInitialiser.DoGetStorageProviderCalls())