Set credentials in pool manager

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2023-07-04 22:11:45 +00:00
parent f12d93f14c
commit 3d26900d32
15 changed files with 314 additions and 48 deletions

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks
@ -28,6 +28,20 @@ func (_m *Store) AddInstanceEvent(ctx context.Context, instanceID string, event
return r0
}
// BreakLockJobIsQueued provides a mock function with given fields: ctx, jobID
func (_m *Store) BreakLockJobIsQueued(ctx context.Context, jobID int64) error {
ret := _m.Called(ctx, jobID)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
r0 = rf(ctx, jobID)
} else {
r0 = ret.Error(0)
}
return r0
}
// ControllerInfo provides a mock function with given fields:
func (_m *Store) ControllerInfo() (params.ControllerInfo, error) {
ret := _m.Called()
@ -124,6 +138,30 @@ func (_m *Store) CreateInstance(ctx context.Context, poolID string, param params
return r0, r1
}
// CreateOrUpdateJob provides a mock function with given fields: ctx, job
func (_m *Store) CreateOrUpdateJob(ctx context.Context, job params.Job) (params.Job, error) {
ret := _m.Called(ctx, job)
var r0 params.Job
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, params.Job) (params.Job, error)); ok {
return rf(ctx, job)
}
if rf, ok := ret.Get(0).(func(context.Context, params.Job) params.Job); ok {
r0 = rf(ctx, job)
} else {
r0 = ret.Get(0).(params.Job)
}
if rf, ok := ret.Get(1).(func(context.Context, params.Job) error); ok {
r1 = rf(ctx, job)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateOrganization provides a mock function with given fields: ctx, name, credentialsName, webhookSecret
func (_m *Store) CreateOrganization(ctx context.Context, name string, credentialsName string, webhookSecret string) (params.Organization, error) {
ret := _m.Called(ctx, name, credentialsName, webhookSecret)
@ -244,6 +282,20 @@ func (_m *Store) CreateUser(ctx context.Context, user params.NewUserParams) (par
return r0, r1
}
// DeleteCompletedJobs provides a mock function with given fields: ctx
func (_m *Store) DeleteCompletedJobs(ctx context.Context) error {
ret := _m.Called(ctx)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = rf(ctx)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeleteEnterprise provides a mock function with given fields: ctx, enterpriseID
func (_m *Store) DeleteEnterprise(ctx context.Context, enterpriseID string) error {
ret := _m.Called(ctx, enterpriseID)
@ -286,6 +338,20 @@ func (_m *Store) DeleteInstance(ctx context.Context, poolID string, instanceName
return r0
}
// DeleteJob provides a mock function with given fields: ctx, jobID
func (_m *Store) DeleteJob(ctx context.Context, jobID int64) error {
ret := _m.Called(ctx, jobID)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
r0 = rf(ctx, jobID)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeleteOrganization provides a mock function with given fields: ctx, orgID
func (_m *Store) DeleteOrganization(ctx context.Context, orgID string) error {
ret := _m.Called(ctx, orgID)
@ -404,6 +470,32 @@ func (_m *Store) FindOrganizationPoolByTags(ctx context.Context, orgID string, t
return r0, r1
}
// FindPoolsMatchingAllTags provides a mock function with given fields: ctx, entityType, entityID, tags
func (_m *Store) FindPoolsMatchingAllTags(ctx context.Context, entityType params.PoolType, entityID string, tags []string) ([]params.Pool, error) {
ret := _m.Called(ctx, entityType, entityID, tags)
var r0 []params.Pool
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, params.PoolType, string, []string) ([]params.Pool, error)); ok {
return rf(ctx, entityType, entityID, tags)
}
if rf, ok := ret.Get(0).(func(context.Context, params.PoolType, string, []string) []params.Pool); ok {
r0 = rf(ctx, entityType, entityID, tags)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]params.Pool)
}
}
if rf, ok := ret.Get(1).(func(context.Context, params.PoolType, string, []string) error); ok {
r1 = rf(ctx, entityType, entityID, tags)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FindRepositoryPoolByTags provides a mock function with given fields: ctx, repoID, tags
func (_m *Store) FindRepositoryPoolByTags(ctx context.Context, repoID string, tags []string) (params.Pool, error) {
ret := _m.Called(ctx, repoID, tags)
@ -524,6 +616,30 @@ func (_m *Store) GetInstanceByName(ctx context.Context, instanceName string) (pa
return r0, r1
}
// GetJobByID provides a mock function with given fields: ctx, jobID
func (_m *Store) GetJobByID(ctx context.Context, jobID int64) (params.Job, error) {
ret := _m.Called(ctx, jobID)
var r0 params.Job
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64) (params.Job, error)); ok {
return rf(ctx, jobID)
}
if rf, ok := ret.Get(0).(func(context.Context, int64) params.Job); ok {
r0 = rf(ctx, jobID)
} else {
r0 = ret.Get(0).(params.Job)
}
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
r1 = rf(ctx, jobID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetOrganization provides a mock function with given fields: ctx, name
func (_m *Store) GetOrganization(ctx context.Context, name string) (params.Organization, error) {
ret := _m.Called(ctx, name)
@ -828,6 +944,32 @@ func (_m *Store) ListAllInstances(ctx context.Context) ([]params.Instance, error
return r0, r1
}
// ListAllJobs provides a mock function with given fields: ctx
func (_m *Store) ListAllJobs(ctx context.Context) ([]params.Job, error) {
ret := _m.Called(ctx)
var r0 []params.Job
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]params.Job, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) []params.Job); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]params.Job)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListAllPools provides a mock function with given fields: ctx
func (_m *Store) ListAllPools(ctx context.Context) ([]params.Pool, error) {
ret := _m.Called(ctx)
@ -932,6 +1074,32 @@ func (_m *Store) ListEnterprises(ctx context.Context) ([]params.Enterprise, erro
return r0, r1
}
// ListEntityJobsByStatus provides a mock function with given fields: ctx, entityType, entityID, status
func (_m *Store) ListEntityJobsByStatus(ctx context.Context, entityType params.PoolType, entityID string, status params.JobStatus) ([]params.Job, error) {
ret := _m.Called(ctx, entityType, entityID, status)
var r0 []params.Job
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, params.PoolType, string, params.JobStatus) ([]params.Job, error)); ok {
return rf(ctx, entityType, entityID, status)
}
if rf, ok := ret.Get(0).(func(context.Context, params.PoolType, string, params.JobStatus) []params.Job); ok {
r0 = rf(ctx, entityType, entityID, status)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]params.Job)
}
}
if rf, ok := ret.Get(1).(func(context.Context, params.PoolType, string, params.JobStatus) error); ok {
r1 = rf(ctx, entityType, entityID, status)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListInstanceEvents provides a mock function with given fields: ctx, instanceID, eventType, eventLevel
func (_m *Store) ListInstanceEvents(ctx context.Context, instanceID string, eventType params.EventType, eventLevel params.EventLevel) ([]params.StatusMessage, error) {
ret := _m.Called(ctx, instanceID, eventType, eventLevel)
@ -958,6 +1126,32 @@ func (_m *Store) ListInstanceEvents(ctx context.Context, instanceID string, even
return r0, r1
}
// ListJobsByStatus provides a mock function with given fields: ctx, status
func (_m *Store) ListJobsByStatus(ctx context.Context, status params.JobStatus) ([]params.Job, error) {
ret := _m.Called(ctx, status)
var r0 []params.Job
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, params.JobStatus) ([]params.Job, error)); ok {
return rf(ctx, status)
}
if rf, ok := ret.Get(0).(func(context.Context, params.JobStatus) []params.Job); ok {
r0 = rf(ctx, status)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]params.Job)
}
}
if rf, ok := ret.Get(1).(func(context.Context, params.JobStatus) error); ok {
r1 = rf(ctx, status)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListOrgInstances provides a mock function with given fields: ctx, orgID
func (_m *Store) ListOrgInstances(ctx context.Context, orgID string) ([]params.Instance, error) {
ret := _m.Called(ctx, orgID)
@ -1140,6 +1334,20 @@ func (_m *Store) ListRepositories(ctx context.Context) ([]params.Repository, err
return r0, r1
}
// LockJob provides a mock function with given fields: ctx, jobID, entityID
func (_m *Store) LockJob(ctx context.Context, jobID int64, entityID string) error {
ret := _m.Called(ctx, jobID, entityID)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok {
r0 = rf(ctx, jobID, entityID)
} else {
r0 = ret.Error(0)
}
return r0
}
// PoolInstanceCount provides a mock function with given fields: ctx, poolID
func (_m *Store) PoolInstanceCount(ctx context.Context, poolID string) (int64, error) {
ret := _m.Called(ctx, poolID)
@ -1164,6 +1372,20 @@ func (_m *Store) PoolInstanceCount(ctx context.Context, poolID string) (int64, e
return r0, r1
}
// UnlockJob provides a mock function with given fields: ctx, jobID, entityID
func (_m *Store) UnlockJob(ctx context.Context, jobID int64, entityID string) error {
ret := _m.Called(ctx, jobID, entityID)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok {
r0 = rf(ctx, jobID, entityID)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateEnterprise provides a mock function with given fields: ctx, enterpriseID, param
func (_m *Store) UpdateEnterprise(ctx context.Context, enterpriseID string, param params.UpdateRepositoryParams) (params.Enterprise, error) {
ret := _m.Called(ctx, enterpriseID, param)
@ -1356,13 +1578,12 @@ func (_m *Store) UpdateUser(ctx context.Context, user string, param params.Updat
return r0, r1
}
type mockConstructorTestingTNewStore interface {
// NewStore creates a new instance of Store. 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 NewStore(t interface {
mock.TestingT
Cleanup(func())
}
// NewStore creates a new instance of Store. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewStore(t mockConstructorTestingTNewStore) *Store {
}) *Store {
mock := &Store{}
mock.Mock.Test(t)