grafana/pkg/services/rendering/mock.go
Joe Blubaugh 687e79538b
Alerting: Add a general screenshot service and alerting-specific image service. (#49293)
This commit adds a pkg/services/screenshot package for taking and uploading screenshots of Grafana dashboards. It supports taking screenshots of both dashboards and individual panels within a dashboard, using the rendering service.

The screenshot package has the following services, most of which can be composed:

BrowserScreenshotService (Takes screenshots with headless Chrome)
CachableScreenshotService (Caches screenshots taken with another service such as BrowserScreenshotService)
NoopScreenshotService (A no-op screenshot service for tests)
SingleFlightScreenshotService (Prevents duplicate screenshots when taking screenshots of the same dashboard or panel in parallel)
ScreenshotUnavailableService (A screenshot service that returns ErrScreenshotsUnavailable)
UploadingScreenshotService (A screenshot service that uploads taken screenshots)

The screenshot package does not support wire dependency injection yet. ngalert constructs its own version of the service. See https://github.com/grafana/grafana/issues/49296

This PR also adds an ImageScreenshotService to ngAlert. This is used to take screenshots with a screenshotservice and then store their location reference for use by alert instances and notifiers.
2022-05-22 22:33:49 +08:00

155 lines
5.4 KiB
Go

// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/grafana/grafana/pkg/services/rendering (interfaces: Service)
// Package rendering is a generated GoMock package.
package rendering
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
models "github.com/grafana/grafana/pkg/models"
)
// MockService is a mock of Service interface.
type MockService struct {
ctrl *gomock.Controller
recorder *MockServiceMockRecorder
}
// MockServiceMockRecorder is the mock recorder for MockService.
type MockServiceMockRecorder struct {
mock *MockService
}
// NewMockService creates a new mock instance.
func NewMockService(ctrl *gomock.Controller) *MockService {
mock := &MockService{ctrl: ctrl}
mock.recorder = &MockServiceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockService) EXPECT() *MockServiceMockRecorder {
return m.recorder
}
// CreateRenderingSession mocks base method.
func (m *MockService) CreateRenderingSession(arg0 context.Context, arg1 AuthOpts, arg2 SessionOpts) (Session, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateRenderingSession", arg0, arg1, arg2)
ret0, _ := ret[0].(Session)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CreateRenderingSession indicates an expected call of CreateRenderingSession.
func (mr *MockServiceMockRecorder) CreateRenderingSession(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRenderingSession", reflect.TypeOf((*MockService)(nil).CreateRenderingSession), arg0, arg1, arg2)
}
// GetRenderUser mocks base method.
func (m *MockService) GetRenderUser(arg0 context.Context, arg1 string) (*RenderUser, bool) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetRenderUser", arg0, arg1)
ret0, _ := ret[0].(*RenderUser)
ret1, _ := ret[1].(bool)
return ret0, ret1
}
// GetRenderUser indicates an expected call of GetRenderUser.
func (mr *MockServiceMockRecorder) GetRenderUser(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRenderUser", reflect.TypeOf((*MockService)(nil).GetRenderUser), arg0, arg1)
}
// HasCapability mocks base method.
func (m *MockService) HasCapability(arg0 CapabilityName) (CapabilitySupportRequestResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HasCapability", arg0)
ret0, _ := ret[0].(CapabilitySupportRequestResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// HasCapability indicates an expected call of HasCapability.
func (mr *MockServiceMockRecorder) HasCapability(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasCapability", reflect.TypeOf((*MockService)(nil).HasCapability), arg0)
}
// IsAvailable mocks base method.
func (m *MockService) IsAvailable() bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IsAvailable")
ret0, _ := ret[0].(bool)
return ret0
}
// IsAvailable indicates an expected call of IsAvailable.
func (mr *MockServiceMockRecorder) IsAvailable() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAvailable", reflect.TypeOf((*MockService)(nil).IsAvailable))
}
// Render mocks base method.
func (m *MockService) Render(arg0 context.Context, arg1 Opts, arg2 Session) (*RenderResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Render", arg0, arg1, arg2)
ret0, _ := ret[0].(*RenderResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Render indicates an expected call of Render.
func (mr *MockServiceMockRecorder) Render(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Render", reflect.TypeOf((*MockService)(nil).Render), arg0, arg1, arg2)
}
// RenderCSV mocks base method.
func (m *MockService) RenderCSV(arg0 context.Context, arg1 CSVOpts, arg2 Session) (*RenderCSVResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RenderCSV", arg0, arg1, arg2)
ret0, _ := ret[0].(*RenderCSVResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// RenderCSV indicates an expected call of RenderCSV.
func (mr *MockServiceMockRecorder) RenderCSV(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RenderCSV", reflect.TypeOf((*MockService)(nil).RenderCSV), arg0, arg1, arg2)
}
// RenderErrorImage mocks base method.
func (m *MockService) RenderErrorImage(arg0 models.Theme, arg1 error) (*RenderResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RenderErrorImage", arg0, arg1)
ret0, _ := ret[0].(*RenderResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// RenderErrorImage indicates an expected call of RenderErrorImage.
func (mr *MockServiceMockRecorder) RenderErrorImage(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RenderErrorImage", reflect.TypeOf((*MockService)(nil).RenderErrorImage), arg0, arg1)
}
// Version mocks base method.
func (m *MockService) Version() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Version")
ret0, _ := ret[0].(string)
return ret0
}
// Version indicates an expected call of Version.
func (mr *MockServiceMockRecorder) Version() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockService)(nil).Version))
}