This change adds a single page application front-end to GARM. It uses a generated REST client, built from the swagger definitions, the websocket interface for live updates of entities and eager loading of everything except runners, as users may have many runners and we don't want to load hundreds of runners in memory. Proper pagination should be implemented in the API, in future commits, to avoid loading lots of elements for no reason. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
499 lines
17 KiB
Go
499 lines
17 KiB
Go
// Code generated by mockery. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
common "github.com/cloudbase/garm/runner/common"
|
|
|
|
garm_provider_commonparams "github.com/cloudbase/garm-provider-common/params"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
params "github.com/cloudbase/garm/params"
|
|
)
|
|
|
|
// Provider is an autogenerated mock type for the Provider type
|
|
type Provider struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type Provider_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *Provider) EXPECT() *Provider_Expecter {
|
|
return &Provider_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// AsParams provides a mock function with no fields
|
|
func (_m *Provider) AsParams() params.Provider {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for AsParams")
|
|
}
|
|
|
|
var r0 params.Provider
|
|
if rf, ok := ret.Get(0).(func() params.Provider); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(params.Provider)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Provider_AsParams_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AsParams'
|
|
type Provider_AsParams_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// AsParams is a helper method to define mock.On call
|
|
func (_e *Provider_Expecter) AsParams() *Provider_AsParams_Call {
|
|
return &Provider_AsParams_Call{Call: _e.mock.On("AsParams")}
|
|
}
|
|
|
|
func (_c *Provider_AsParams_Call) Run(run func()) *Provider_AsParams_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_AsParams_Call) Return(_a0 params.Provider) *Provider_AsParams_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_AsParams_Call) RunAndReturn(run func() params.Provider) *Provider_AsParams_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// CreateInstance provides a mock function with given fields: ctx, bootstrapParams, createInstanceParams
|
|
func (_m *Provider) CreateInstance(ctx context.Context, bootstrapParams garm_provider_commonparams.BootstrapInstance, createInstanceParams common.CreateInstanceParams) (garm_provider_commonparams.ProviderInstance, error) {
|
|
ret := _m.Called(ctx, bootstrapParams, createInstanceParams)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CreateInstance")
|
|
}
|
|
|
|
var r0 garm_provider_commonparams.ProviderInstance
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, garm_provider_commonparams.BootstrapInstance, common.CreateInstanceParams) (garm_provider_commonparams.ProviderInstance, error)); ok {
|
|
return rf(ctx, bootstrapParams, createInstanceParams)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, garm_provider_commonparams.BootstrapInstance, common.CreateInstanceParams) garm_provider_commonparams.ProviderInstance); ok {
|
|
r0 = rf(ctx, bootstrapParams, createInstanceParams)
|
|
} else {
|
|
r0 = ret.Get(0).(garm_provider_commonparams.ProviderInstance)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, garm_provider_commonparams.BootstrapInstance, common.CreateInstanceParams) error); ok {
|
|
r1 = rf(ctx, bootstrapParams, createInstanceParams)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Provider_CreateInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateInstance'
|
|
type Provider_CreateInstance_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// CreateInstance is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - bootstrapParams garm_provider_commonparams.BootstrapInstance
|
|
// - createInstanceParams common.CreateInstanceParams
|
|
func (_e *Provider_Expecter) CreateInstance(ctx interface{}, bootstrapParams interface{}, createInstanceParams interface{}) *Provider_CreateInstance_Call {
|
|
return &Provider_CreateInstance_Call{Call: _e.mock.On("CreateInstance", ctx, bootstrapParams, createInstanceParams)}
|
|
}
|
|
|
|
func (_c *Provider_CreateInstance_Call) Run(run func(ctx context.Context, bootstrapParams garm_provider_commonparams.BootstrapInstance, createInstanceParams common.CreateInstanceParams)) *Provider_CreateInstance_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(garm_provider_commonparams.BootstrapInstance), args[2].(common.CreateInstanceParams))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_CreateInstance_Call) Return(_a0 garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_CreateInstance_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_CreateInstance_Call) RunAndReturn(run func(context.Context, garm_provider_commonparams.BootstrapInstance, common.CreateInstanceParams) (garm_provider_commonparams.ProviderInstance, error)) *Provider_CreateInstance_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// DeleteInstance provides a mock function with given fields: ctx, instance, deleteInstanceParams
|
|
func (_m *Provider) DeleteInstance(ctx context.Context, instance string, deleteInstanceParams common.DeleteInstanceParams) error {
|
|
ret := _m.Called(ctx, instance, deleteInstanceParams)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteInstance")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, common.DeleteInstanceParams) error); ok {
|
|
r0 = rf(ctx, instance, deleteInstanceParams)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Provider_DeleteInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteInstance'
|
|
type Provider_DeleteInstance_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// DeleteInstance is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - instance string
|
|
// - deleteInstanceParams common.DeleteInstanceParams
|
|
func (_e *Provider_Expecter) DeleteInstance(ctx interface{}, instance interface{}, deleteInstanceParams interface{}) *Provider_DeleteInstance_Call {
|
|
return &Provider_DeleteInstance_Call{Call: _e.mock.On("DeleteInstance", ctx, instance, deleteInstanceParams)}
|
|
}
|
|
|
|
func (_c *Provider_DeleteInstance_Call) Run(run func(ctx context.Context, instance string, deleteInstanceParams common.DeleteInstanceParams)) *Provider_DeleteInstance_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(common.DeleteInstanceParams))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_DeleteInstance_Call) Return(_a0 error) *Provider_DeleteInstance_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_DeleteInstance_Call) RunAndReturn(run func(context.Context, string, common.DeleteInstanceParams) error) *Provider_DeleteInstance_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// DisableJITConfig provides a mock function with no fields
|
|
func (_m *Provider) DisableJITConfig() bool {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DisableJITConfig")
|
|
}
|
|
|
|
var r0 bool
|
|
if rf, ok := ret.Get(0).(func() bool); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Provider_DisableJITConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisableJITConfig'
|
|
type Provider_DisableJITConfig_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// DisableJITConfig is a helper method to define mock.On call
|
|
func (_e *Provider_Expecter) DisableJITConfig() *Provider_DisableJITConfig_Call {
|
|
return &Provider_DisableJITConfig_Call{Call: _e.mock.On("DisableJITConfig")}
|
|
}
|
|
|
|
func (_c *Provider_DisableJITConfig_Call) Run(run func()) *Provider_DisableJITConfig_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_DisableJITConfig_Call) Return(_a0 bool) *Provider_DisableJITConfig_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_DisableJITConfig_Call) RunAndReturn(run func() bool) *Provider_DisableJITConfig_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetInstance provides a mock function with given fields: ctx, instance, getInstanceParams
|
|
func (_m *Provider) GetInstance(ctx context.Context, instance string, getInstanceParams common.GetInstanceParams) (garm_provider_commonparams.ProviderInstance, error) {
|
|
ret := _m.Called(ctx, instance, getInstanceParams)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetInstance")
|
|
}
|
|
|
|
var r0 garm_provider_commonparams.ProviderInstance
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, common.GetInstanceParams) (garm_provider_commonparams.ProviderInstance, error)); ok {
|
|
return rf(ctx, instance, getInstanceParams)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, common.GetInstanceParams) garm_provider_commonparams.ProviderInstance); ok {
|
|
r0 = rf(ctx, instance, getInstanceParams)
|
|
} else {
|
|
r0 = ret.Get(0).(garm_provider_commonparams.ProviderInstance)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, common.GetInstanceParams) error); ok {
|
|
r1 = rf(ctx, instance, getInstanceParams)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Provider_GetInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInstance'
|
|
type Provider_GetInstance_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetInstance is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - instance string
|
|
// - getInstanceParams common.GetInstanceParams
|
|
func (_e *Provider_Expecter) GetInstance(ctx interface{}, instance interface{}, getInstanceParams interface{}) *Provider_GetInstance_Call {
|
|
return &Provider_GetInstance_Call{Call: _e.mock.On("GetInstance", ctx, instance, getInstanceParams)}
|
|
}
|
|
|
|
func (_c *Provider_GetInstance_Call) Run(run func(ctx context.Context, instance string, getInstanceParams common.GetInstanceParams)) *Provider_GetInstance_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(common.GetInstanceParams))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_GetInstance_Call) Return(_a0 garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_GetInstance_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_GetInstance_Call) RunAndReturn(run func(context.Context, string, common.GetInstanceParams) (garm_provider_commonparams.ProviderInstance, error)) *Provider_GetInstance_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ListInstances provides a mock function with given fields: ctx, poolID, listInstancesParams
|
|
func (_m *Provider) ListInstances(ctx context.Context, poolID string, listInstancesParams common.ListInstancesParams) ([]garm_provider_commonparams.ProviderInstance, error) {
|
|
ret := _m.Called(ctx, poolID, listInstancesParams)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListInstances")
|
|
}
|
|
|
|
var r0 []garm_provider_commonparams.ProviderInstance
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, common.ListInstancesParams) ([]garm_provider_commonparams.ProviderInstance, error)); ok {
|
|
return rf(ctx, poolID, listInstancesParams)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, common.ListInstancesParams) []garm_provider_commonparams.ProviderInstance); ok {
|
|
r0 = rf(ctx, poolID, listInstancesParams)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]garm_provider_commonparams.ProviderInstance)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, common.ListInstancesParams) error); ok {
|
|
r1 = rf(ctx, poolID, listInstancesParams)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Provider_ListInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListInstances'
|
|
type Provider_ListInstances_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListInstances is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - poolID string
|
|
// - listInstancesParams common.ListInstancesParams
|
|
func (_e *Provider_Expecter) ListInstances(ctx interface{}, poolID interface{}, listInstancesParams interface{}) *Provider_ListInstances_Call {
|
|
return &Provider_ListInstances_Call{Call: _e.mock.On("ListInstances", ctx, poolID, listInstancesParams)}
|
|
}
|
|
|
|
func (_c *Provider_ListInstances_Call) Run(run func(ctx context.Context, poolID string, listInstancesParams common.ListInstancesParams)) *Provider_ListInstances_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(common.ListInstancesParams))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_ListInstances_Call) Return(_a0 []garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_ListInstances_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_ListInstances_Call) RunAndReturn(run func(context.Context, string, common.ListInstancesParams) ([]garm_provider_commonparams.ProviderInstance, error)) *Provider_ListInstances_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RemoveAllInstances provides a mock function with given fields: ctx, removeAllInstancesParams
|
|
func (_m *Provider) RemoveAllInstances(ctx context.Context, removeAllInstancesParams common.RemoveAllInstancesParams) error {
|
|
ret := _m.Called(ctx, removeAllInstancesParams)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RemoveAllInstances")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, common.RemoveAllInstancesParams) error); ok {
|
|
r0 = rf(ctx, removeAllInstancesParams)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Provider_RemoveAllInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveAllInstances'
|
|
type Provider_RemoveAllInstances_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RemoveAllInstances is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - removeAllInstancesParams common.RemoveAllInstancesParams
|
|
func (_e *Provider_Expecter) RemoveAllInstances(ctx interface{}, removeAllInstancesParams interface{}) *Provider_RemoveAllInstances_Call {
|
|
return &Provider_RemoveAllInstances_Call{Call: _e.mock.On("RemoveAllInstances", ctx, removeAllInstancesParams)}
|
|
}
|
|
|
|
func (_c *Provider_RemoveAllInstances_Call) Run(run func(ctx context.Context, removeAllInstancesParams common.RemoveAllInstancesParams)) *Provider_RemoveAllInstances_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(common.RemoveAllInstancesParams))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_RemoveAllInstances_Call) Return(_a0 error) *Provider_RemoveAllInstances_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_RemoveAllInstances_Call) RunAndReturn(run func(context.Context, common.RemoveAllInstancesParams) error) *Provider_RemoveAllInstances_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Start provides a mock function with given fields: ctx, instance, startParams
|
|
func (_m *Provider) Start(ctx context.Context, instance string, startParams common.StartParams) error {
|
|
ret := _m.Called(ctx, instance, startParams)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Start")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, common.StartParams) error); ok {
|
|
r0 = rf(ctx, instance, startParams)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Provider_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
|
type Provider_Start_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Start is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - instance string
|
|
// - startParams common.StartParams
|
|
func (_e *Provider_Expecter) Start(ctx interface{}, instance interface{}, startParams interface{}) *Provider_Start_Call {
|
|
return &Provider_Start_Call{Call: _e.mock.On("Start", ctx, instance, startParams)}
|
|
}
|
|
|
|
func (_c *Provider_Start_Call) Run(run func(ctx context.Context, instance string, startParams common.StartParams)) *Provider_Start_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(common.StartParams))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_Start_Call) Return(_a0 error) *Provider_Start_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_Start_Call) RunAndReturn(run func(context.Context, string, common.StartParams) error) *Provider_Start_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Stop provides a mock function with given fields: ctx, instance, stopParams
|
|
func (_m *Provider) Stop(ctx context.Context, instance string, stopParams common.StopParams) error {
|
|
ret := _m.Called(ctx, instance, stopParams)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Stop")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, common.StopParams) error); ok {
|
|
r0 = rf(ctx, instance, stopParams)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Provider_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
|
|
type Provider_Stop_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Stop is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - instance string
|
|
// - stopParams common.StopParams
|
|
func (_e *Provider_Expecter) Stop(ctx interface{}, instance interface{}, stopParams interface{}) *Provider_Stop_Call {
|
|
return &Provider_Stop_Call{Call: _e.mock.On("Stop", ctx, instance, stopParams)}
|
|
}
|
|
|
|
func (_c *Provider_Stop_Call) Run(run func(ctx context.Context, instance string, stopParams common.StopParams)) *Provider_Stop_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(common.StopParams))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_Stop_Call) Return(_a0 error) *Provider_Stop_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Provider_Stop_Call) RunAndReturn(run func(context.Context, string, common.StopParams) error) *Provider_Stop_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewProvider creates a new instance of Provider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewProvider(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *Provider {
|
|
mock := &Provider{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|