This change allows users to bypass GitHub Unauthorized errors when removing github runners. This means that removing runners will now be possible even if the pool manager is stopped. There is a new flag added to the runner rm command and to the API that tells GARM to bypass pool being stopped and any 401 error returned by GitHub. This means you will be able to remove the runners from garm and your provider, but will mean that the runner will still exist in github as "offline" if the credentials are not updated or the runner manually removed. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
321 lines
6.9 KiB
Go
321 lines
6.9 KiB
Go
// Code generated by mockery v2.42.0. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
params "github.com/cloudbase/garm/params"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// PoolManager is an autogenerated mock type for the PoolManager type
|
|
type PoolManager struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// DeleteRunner provides a mock function with given fields: runner, forceRemove, bypassGHUnauthorizedError
|
|
func (_m *PoolManager) DeleteRunner(runner params.Instance, forceRemove bool, bypassGHUnauthorizedError bool) error {
|
|
ret := _m.Called(runner, forceRemove, bypassGHUnauthorizedError)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteRunner")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(params.Instance, bool, bool) error); ok {
|
|
r0 = rf(runner, forceRemove, bypassGHUnauthorizedError)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetWebhookInfo provides a mock function with given fields: ctx
|
|
func (_m *PoolManager) GetWebhookInfo(ctx context.Context) (params.HookInfo, error) {
|
|
ret := _m.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetWebhookInfo")
|
|
}
|
|
|
|
var r0 params.HookInfo
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) (params.HookInfo, error)); ok {
|
|
return rf(ctx)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context) params.HookInfo); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
r0 = ret.Get(0).(params.HookInfo)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
|
r1 = rf(ctx)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GithubRunnerRegistrationToken provides a mock function with given fields:
|
|
func (_m *PoolManager) GithubRunnerRegistrationToken() (string, error) {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GithubRunnerRegistrationToken")
|
|
}
|
|
|
|
var r0 string
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func() (string, error)); ok {
|
|
return rf()
|
|
}
|
|
if rf, ok := ret.Get(0).(func() string); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func() error); ok {
|
|
r1 = rf()
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// HandleWorkflowJob provides a mock function with given fields: job
|
|
func (_m *PoolManager) HandleWorkflowJob(job params.WorkflowJob) error {
|
|
ret := _m.Called(job)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for HandleWorkflowJob")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(params.WorkflowJob) error); ok {
|
|
r0 = rf(job)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// ID provides a mock function with given fields:
|
|
func (_m *PoolManager) ID() string {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ID")
|
|
}
|
|
|
|
var r0 string
|
|
if rf, ok := ret.Get(0).(func() string); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// InstallWebhook provides a mock function with given fields: ctx, param
|
|
func (_m *PoolManager) InstallWebhook(ctx context.Context, param params.InstallWebhookParams) (params.HookInfo, error) {
|
|
ret := _m.Called(ctx, param)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for InstallWebhook")
|
|
}
|
|
|
|
var r0 params.HookInfo
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, params.InstallWebhookParams) (params.HookInfo, error)); ok {
|
|
return rf(ctx, param)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, params.InstallWebhookParams) params.HookInfo); ok {
|
|
r0 = rf(ctx, param)
|
|
} else {
|
|
r0 = ret.Get(0).(params.HookInfo)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, params.InstallWebhookParams) error); ok {
|
|
r1 = rf(ctx, param)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// RefreshState provides a mock function with given fields: param
|
|
func (_m *PoolManager) RefreshState(param params.UpdatePoolStateParams) error {
|
|
ret := _m.Called(param)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RefreshState")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(params.UpdatePoolStateParams) error); ok {
|
|
r0 = rf(param)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// RootCABundle provides a mock function with given fields:
|
|
func (_m *PoolManager) RootCABundle() (params.CertificateBundle, error) {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RootCABundle")
|
|
}
|
|
|
|
var r0 params.CertificateBundle
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func() (params.CertificateBundle, error)); ok {
|
|
return rf()
|
|
}
|
|
if rf, ok := ret.Get(0).(func() params.CertificateBundle); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(params.CertificateBundle)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func() error); ok {
|
|
r1 = rf()
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Start provides a mock function with given fields:
|
|
func (_m *PoolManager) Start() error {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Start")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func() error); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Status provides a mock function with given fields:
|
|
func (_m *PoolManager) Status() params.PoolManagerStatus {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Status")
|
|
}
|
|
|
|
var r0 params.PoolManagerStatus
|
|
if rf, ok := ret.Get(0).(func() params.PoolManagerStatus); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(params.PoolManagerStatus)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Stop provides a mock function with given fields:
|
|
func (_m *PoolManager) Stop() error {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Stop")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func() error); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UninstallWebhook provides a mock function with given fields: ctx
|
|
func (_m *PoolManager) UninstallWebhook(ctx context.Context) error {
|
|
ret := _m.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UninstallWebhook")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Wait provides a mock function with given fields:
|
|
func (_m *PoolManager) Wait() error {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Wait")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func() error); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// WebhookSecret provides a mock function with given fields:
|
|
func (_m *PoolManager) WebhookSecret() string {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for WebhookSecret")
|
|
}
|
|
|
|
var r0 string
|
|
if rf, ok := ret.Get(0).(func() string); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// NewPoolManager creates a new instance of PoolManager. 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 NewPoolManager(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *PoolManager {
|
|
mock := &PoolManager{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|