fix: unused-parameter linter findings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
This commit is contained in:
parent
73eb21438a
commit
9f5c38ef2d
28 changed files with 146 additions and 148 deletions
|
|
@ -15,12 +15,12 @@
|
|||
package sql
|
||||
|
||||
import (
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/gorm"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (s *sqlDatabase) ControllerInfo() (params.ControllerInfo, error) {
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing" //nolint:typecheck
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type CtrlTestSuite struct {
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ package sql
|
|||
import (
|
||||
"context"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (s *sqlDatabase) CreateEnterprise(ctx context.Context, name, credentialsName, webhookSecret string) (params.Enterprise, error) {
|
||||
func (s *sqlDatabase) CreateEnterprise(_ context.Context, name, credentialsName, webhookSecret string) (params.Enterprise, error) {
|
||||
if webhookSecret == "" {
|
||||
return params.Enterprise{}, errors.New("creating enterprise: missing secret")
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ func (s *sqlDatabase) GetEnterpriseByID(ctx context.Context, enterpriseID string
|
|||
return param, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) ListEnterprises(ctx context.Context) ([]params.Enterprise, error) {
|
||||
func (s *sqlDatabase) ListEnterprises(_ context.Context) ([]params.Enterprise, error) {
|
||||
var enterprises []Enterprise
|
||||
q := s.conn.Find(&enterprises)
|
||||
if q.Error != nil {
|
||||
|
|
@ -224,7 +224,7 @@ func (s *sqlDatabase) UpdateEnterprisePool(ctx context.Context, enterpriseID, po
|
|||
return s.updatePool(pool, param)
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) FindEnterprisePoolByTags(ctx context.Context, enterpriseID string, tags []string) (params.Pool, error) {
|
||||
func (s *sqlDatabase) FindEnterprisePoolByTags(_ context.Context, enterpriseID string, tags []string) (params.Pool, error) {
|
||||
pool, err := s.findPoolByTags(enterpriseID, params.EnterprisePool, tags)
|
||||
if err != nil {
|
||||
return params.Pool{}, errors.Wrap(err, "fetching pool")
|
||||
|
|
@ -267,7 +267,7 @@ func (s *sqlDatabase) ListEnterpriseInstances(ctx context.Context, enterpriseID
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getEnterprise(ctx context.Context, name string) (Enterprise, error) {
|
||||
func (s *sqlDatabase) getEnterprise(_ context.Context, name string) (Enterprise, error) {
|
||||
var enterprise Enterprise
|
||||
|
||||
q := s.conn.Where("name = ? COLLATE NOCASE", name)
|
||||
|
|
@ -281,7 +281,7 @@ func (s *sqlDatabase) getEnterprise(ctx context.Context, name string) (Enterpris
|
|||
return enterprise, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getEnterpriseByID(ctx context.Context, id string, preload ...string) (Enterprise, error) {
|
||||
func (s *sqlDatabase) getEnterpriseByID(_ context.Context, id string, preload ...string) (Enterprise, error) {
|
||||
u, err := uuid.Parse(id)
|
||||
if err != nil {
|
||||
return Enterprise{}, errors.Wrap(runnerErrors.ErrBadRequest, "parsing id")
|
||||
|
|
|
|||
|
|
@ -22,17 +22,16 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"gopkg.in/DATA-DOG/go-sqlmock.v1"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
type EnterpriseTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -18,15 +18,15 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (s *sqlDatabase) marshalAndSeal(data interface{}) ([]byte, error) {
|
||||
|
|
@ -92,7 +92,7 @@ func (s *sqlDatabase) CreateInstance(ctx context.Context, poolID string, param p
|
|||
return s.sqlToParamsInstance(newInstance)
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getInstanceByID(ctx context.Context, instanceID string) (Instance, error) {
|
||||
func (s *sqlDatabase) getInstanceByID(_ context.Context, instanceID string) (Instance, error) {
|
||||
u, err := uuid.Parse(instanceID)
|
||||
if err != nil {
|
||||
return Instance{}, errors.Wrap(runnerErrors.ErrBadRequest, "parsing id")
|
||||
|
|
@ -128,7 +128,7 @@ func (s *sqlDatabase) getPoolInstanceByName(ctx context.Context, poolID string,
|
|||
return instance, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getInstanceByName(ctx context.Context, instanceName string, preload ...string) (Instance, error) {
|
||||
func (s *sqlDatabase) getInstanceByName(_ context.Context, instanceName string, preload ...string) (Instance, error) {
|
||||
var instance Instance
|
||||
|
||||
q := s.conn
|
||||
|
|
@ -184,7 +184,7 @@ func (s *sqlDatabase) DeleteInstance(ctx context.Context, poolID string, instanc
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) ListInstanceEvents(ctx context.Context, instanceID string, eventType params.EventType, eventLevel params.EventLevel) ([]params.StatusMessage, error) {
|
||||
func (s *sqlDatabase) ListInstanceEvents(_ context.Context, instanceID string, eventType params.EventType, eventLevel params.EventLevel) ([]params.StatusMessage, error) {
|
||||
var events []InstanceStatusUpdate
|
||||
query := s.conn.Model(&InstanceStatusUpdate{}).Where("instance_id = ?", instanceID)
|
||||
if eventLevel != "" {
|
||||
|
|
@ -296,7 +296,7 @@ func (s *sqlDatabase) UpdateInstance(ctx context.Context, instanceID string, par
|
|||
return s.sqlToParamsInstance(instance)
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) ListPoolInstances(ctx context.Context, poolID string) ([]params.Instance, error) {
|
||||
func (s *sqlDatabase) ListPoolInstances(_ context.Context, poolID string) ([]params.Instance, error) {
|
||||
u, err := uuid.Parse(poolID)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(runnerErrors.ErrBadRequest, "parsing id")
|
||||
|
|
@ -319,7 +319,7 @@ func (s *sqlDatabase) ListPoolInstances(ctx context.Context, poolID string) ([]p
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) ListAllInstances(ctx context.Context) ([]params.Instance, error) {
|
||||
func (s *sqlDatabase) ListAllInstances(_ context.Context) ([]params.Instance, error) {
|
||||
var instances []Instance
|
||||
|
||||
q := s.conn.Model(&Instance{}).Find(&instances)
|
||||
|
|
|
|||
|
|
@ -22,18 +22,16 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"gopkg.in/DATA-DOG/go-sqlmock.v1"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"gopkg.in/DATA-DOG/go-sqlmock.v1"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
type InstancesTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ import (
|
|||
"encoding/json"
|
||||
"log/slog"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/database/common"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/database/common"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
var _ common.JobsStore = &sqlDatabase{}
|
||||
|
|
@ -54,7 +55,7 @@ func sqlWorkflowJobToParamsJob(job WorkflowJob) (params.Job, error) {
|
|||
}
|
||||
|
||||
func (s *sqlDatabase) paramsJobToWorkflowJob(ctx context.Context, job params.Job) (WorkflowJob, error) {
|
||||
asJson, err := json.Marshal(job.Labels)
|
||||
asJSON, err := json.Marshal(job.Labels)
|
||||
if err != nil {
|
||||
return WorkflowJob{}, errors.Wrap(err, "marshaling labels")
|
||||
}
|
||||
|
|
@ -76,7 +77,7 @@ func (s *sqlDatabase) paramsJobToWorkflowJob(ctx context.Context, job params.Job
|
|||
RepoID: job.RepoID,
|
||||
OrgID: job.OrgID,
|
||||
EnterpriseID: job.EnterpriseID,
|
||||
Labels: asJson,
|
||||
Labels: asJSON,
|
||||
LockedBy: job.LockedBy,
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +93,7 @@ func (s *sqlDatabase) paramsJobToWorkflowJob(ctx context.Context, job params.Job
|
|||
return workflofJob, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) DeleteJob(ctx context.Context, jobID int64) error {
|
||||
func (s *sqlDatabase) DeleteJob(_ context.Context, jobID int64) error {
|
||||
q := s.conn.Delete(&WorkflowJob{}, jobID)
|
||||
if q.Error != nil {
|
||||
if errors.Is(q.Error, gorm.ErrRecordNotFound) {
|
||||
|
|
@ -103,7 +104,7 @@ func (s *sqlDatabase) DeleteJob(ctx context.Context, jobID int64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) LockJob(ctx context.Context, jobID int64, entityID string) error {
|
||||
func (s *sqlDatabase) LockJob(_ context.Context, jobID int64, entityID string) error {
|
||||
entityUUID, err := uuid.Parse(entityID)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "parsing entity id")
|
||||
|
|
@ -136,7 +137,7 @@ func (s *sqlDatabase) LockJob(ctx context.Context, jobID int64, entityID string)
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) BreakLockJobIsQueued(ctx context.Context, jobID int64) error {
|
||||
func (s *sqlDatabase) BreakLockJobIsQueued(_ context.Context, jobID int64) error {
|
||||
var workflowJob WorkflowJob
|
||||
q := s.conn.Clauses(clause.Locking{Strength: "UPDATE"}).Preload("Instance").Where("id = ? and status = ?", jobID, params.JobStatusQueued).First(&workflowJob)
|
||||
|
||||
|
|
@ -160,7 +161,7 @@ func (s *sqlDatabase) BreakLockJobIsQueued(ctx context.Context, jobID int64) err
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) UnlockJob(ctx context.Context, jobID int64, entityID string) error {
|
||||
func (s *sqlDatabase) UnlockJob(_ context.Context, jobID int64, entityID string) error {
|
||||
var workflowJob WorkflowJob
|
||||
q := s.conn.Clauses(clause.Locking{Strength: "UPDATE"}).Where("id = ?", jobID).First(&workflowJob)
|
||||
|
||||
|
|
@ -250,7 +251,7 @@ func (s *sqlDatabase) CreateOrUpdateJob(ctx context.Context, job params.Job) (pa
|
|||
}
|
||||
|
||||
// ListJobsByStatus lists all jobs for a given status.
|
||||
func (s *sqlDatabase) ListJobsByStatus(ctx context.Context, status params.JobStatus) ([]params.Job, error) {
|
||||
func (s *sqlDatabase) ListJobsByStatus(_ context.Context, status params.JobStatus) ([]params.Job, error) {
|
||||
var jobs []WorkflowJob
|
||||
query := s.conn.Model(&WorkflowJob{}).Preload("Instance").Where("status = ?", status)
|
||||
|
||||
|
|
@ -270,7 +271,7 @@ func (s *sqlDatabase) ListJobsByStatus(ctx context.Context, status params.JobSta
|
|||
}
|
||||
|
||||
// ListEntityJobsByStatus lists all jobs for a given entity type and id.
|
||||
func (s *sqlDatabase) ListEntityJobsByStatus(ctx context.Context, entityType params.PoolType, entityID string, status params.JobStatus) ([]params.Job, error) {
|
||||
func (s *sqlDatabase) ListEntityJobsByStatus(_ context.Context, entityType params.PoolType, entityID string, status params.JobStatus) ([]params.Job, error) {
|
||||
u, err := uuid.Parse(entityID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -306,7 +307,7 @@ func (s *sqlDatabase) ListEntityJobsByStatus(ctx context.Context, entityType par
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) ListAllJobs(ctx context.Context) ([]params.Job, error) {
|
||||
func (s *sqlDatabase) ListAllJobs(_ context.Context) ([]params.Job, error) {
|
||||
var jobs []WorkflowJob
|
||||
query := s.conn.Model(&WorkflowJob{})
|
||||
|
||||
|
|
@ -329,7 +330,7 @@ func (s *sqlDatabase) ListAllJobs(ctx context.Context) ([]params.Job, error) {
|
|||
}
|
||||
|
||||
// GetJobByID gets a job by id.
|
||||
func (s *sqlDatabase) GetJobByID(ctx context.Context, jobID int64) (params.Job, error) {
|
||||
func (s *sqlDatabase) GetJobByID(_ context.Context, jobID int64) (params.Job, error) {
|
||||
var job WorkflowJob
|
||||
query := s.conn.Model(&WorkflowJob{}).Preload("Instance").Where("id = ?", jobID)
|
||||
|
||||
|
|
@ -344,7 +345,7 @@ func (s *sqlDatabase) GetJobByID(ctx context.Context, jobID int64) (params.Job,
|
|||
}
|
||||
|
||||
// DeleteCompletedJobs deletes all completed jobs.
|
||||
func (s *sqlDatabase) DeleteCompletedJobs(ctx context.Context) error {
|
||||
func (s *sqlDatabase) DeleteCompletedJobs(_ context.Context) error {
|
||||
query := s.conn.Model(&WorkflowJob{}).Where("status = ?", params.JobStatusCompleted)
|
||||
|
||||
if err := query.Unscoped().Delete(&WorkflowJob{}); err.Error != nil {
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ package sql
|
|||
import (
|
||||
"time"
|
||||
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
type Base struct {
|
||||
|
|
@ -33,9 +33,9 @@ type Base struct {
|
|||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
}
|
||||
|
||||
func (b *Base) BeforeCreate(tx *gorm.DB) error {
|
||||
emptyId := uuid.UUID{}
|
||||
if b.ID != emptyId {
|
||||
func (b *Base) BeforeCreate(_ *gorm.DB) error {
|
||||
emptyID := uuid.UUID{}
|
||||
if b.ID != emptyID {
|
||||
return nil
|
||||
}
|
||||
newID, err := uuid.NewRandom()
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (s *sqlDatabase) CreateOrganization(ctx context.Context, name, credentialsName, webhookSecret string) (params.Organization, error) {
|
||||
func (s *sqlDatabase) CreateOrganization(_ context.Context, name, credentialsName, webhookSecret string) (params.Organization, error) {
|
||||
if webhookSecret == "" {
|
||||
return params.Organization{}, errors.New("creating org: missing secret")
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ func (s *sqlDatabase) GetOrganization(ctx context.Context, name string) (params.
|
|||
return param, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) ListOrganizations(ctx context.Context) ([]params.Organization, error) {
|
||||
func (s *sqlDatabase) ListOrganizations(_ context.Context) ([]params.Organization, error) {
|
||||
var orgs []Organization
|
||||
q := s.conn.Find(&orgs)
|
||||
if q.Error != nil {
|
||||
|
|
@ -146,12 +146,12 @@ func (s *sqlDatabase) GetOrganizationByID(ctx context.Context, orgID string) (pa
|
|||
return param, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) CreateOrganizationPool(ctx context.Context, orgId string, param params.CreatePoolParams) (params.Pool, error) {
|
||||
func (s *sqlDatabase) CreateOrganizationPool(ctx context.Context, orgID string, param params.CreatePoolParams) (params.Pool, error) {
|
||||
if len(param.Tags) == 0 {
|
||||
return params.Pool{}, runnerErrors.NewBadRequestError("no tags specified")
|
||||
}
|
||||
|
||||
org, err := s.getOrgByID(ctx, orgId)
|
||||
org, err := s.getOrgByID(ctx, orgID)
|
||||
if err != nil {
|
||||
return params.Pool{}, errors.Wrap(err, "fetching org")
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ func (s *sqlDatabase) CreateOrganizationPool(ctx context.Context, orgId string,
|
|||
newPool.ExtraSpecs = datatypes.JSON(param.ExtraSpecs)
|
||||
}
|
||||
|
||||
_, err = s.getOrgPoolByUniqueFields(ctx, orgId, newPool.ProviderName, newPool.Image, newPool.Flavor)
|
||||
_, err = s.getOrgPoolByUniqueFields(ctx, orgID, newPool.ProviderName, newPool.Image, newPool.Flavor)
|
||||
if err != nil {
|
||||
if !errors.Is(err, runnerErrors.ErrNotFound) {
|
||||
return params.Pool{}, errors.Wrap(err, "creating pool")
|
||||
|
|
@ -249,7 +249,7 @@ func (s *sqlDatabase) DeleteOrganizationPool(ctx context.Context, orgID, poolID
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) FindOrganizationPoolByTags(ctx context.Context, orgID string, tags []string) (params.Pool, error) {
|
||||
func (s *sqlDatabase) FindOrganizationPoolByTags(_ context.Context, orgID string, tags []string) (params.Pool, error) {
|
||||
pool, err := s.findPoolByTags(orgID, params.OrganizationPool, tags)
|
||||
if err != nil {
|
||||
return params.Pool{}, errors.Wrap(err, "fetching pool")
|
||||
|
|
@ -284,7 +284,7 @@ func (s *sqlDatabase) UpdateOrganizationPool(ctx context.Context, orgID, poolID
|
|||
return s.updatePool(pool, param)
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getPoolByID(ctx context.Context, poolID string, preload ...string) (Pool, error) {
|
||||
func (s *sqlDatabase) getPoolByID(_ context.Context, poolID string, preload ...string) (Pool, error) {
|
||||
u, err := uuid.Parse(poolID)
|
||||
if err != nil {
|
||||
return Pool{}, errors.Wrap(runnerErrors.ErrBadRequest, "parsing id")
|
||||
|
|
@ -308,7 +308,7 @@ func (s *sqlDatabase) getPoolByID(ctx context.Context, poolID string, preload ..
|
|||
return pool, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getOrgByID(ctx context.Context, id string, preload ...string) (Organization, error) {
|
||||
func (s *sqlDatabase) getOrgByID(_ context.Context, id string, preload ...string) (Organization, error) {
|
||||
u, err := uuid.Parse(id)
|
||||
if err != nil {
|
||||
return Organization{}, errors.Wrap(runnerErrors.ErrBadRequest, "parsing id")
|
||||
|
|
@ -332,7 +332,7 @@ func (s *sqlDatabase) getOrgByID(ctx context.Context, id string, preload ...stri
|
|||
return org, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getOrg(ctx context.Context, name string) (Organization, error) {
|
||||
func (s *sqlDatabase) getOrg(_ context.Context, name string) (Organization, error) {
|
||||
var org Organization
|
||||
|
||||
q := s.conn.Where("name = ? COLLATE NOCASE", name)
|
||||
|
|
|
|||
|
|
@ -22,16 +22,16 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"gopkg.in/DATA-DOG/go-sqlmock.v1"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
type OrgTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -18,15 +18,15 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/gorm"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (s *sqlDatabase) ListAllPools(ctx context.Context) ([]params.Pool, error) {
|
||||
func (s *sqlDatabase) ListAllPools(_ context.Context) ([]params.Pool, error) {
|
||||
var pools []Pool
|
||||
|
||||
q := s.conn.Model(&Pool{}).
|
||||
|
|
@ -72,7 +72,7 @@ func (s *sqlDatabase) DeletePoolByID(ctx context.Context, poolID string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getEntityPool(ctx context.Context, entityType params.PoolType, entityID, poolID string, preload ...string) (Pool, error) {
|
||||
func (s *sqlDatabase) getEntityPool(_ context.Context, entityType params.PoolType, entityID, poolID string, preload ...string) (Pool, error) {
|
||||
if entityID == "" {
|
||||
return Pool{}, errors.Wrap(runnerErrors.ErrBadRequest, "missing entity id")
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ func (s *sqlDatabase) getEntityPool(ctx context.Context, entityType params.PoolT
|
|||
return pool, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) listEntityPools(ctx context.Context, entityType params.PoolType, entityID string, preload ...string) ([]Pool, error) {
|
||||
func (s *sqlDatabase) listEntityPools(_ context.Context, entityType params.PoolType, entityID string, preload ...string) ([]Pool, error) {
|
||||
if _, err := uuid.Parse(entityID); err != nil {
|
||||
return nil, errors.Wrap(runnerErrors.ErrBadRequest, "parsing id")
|
||||
}
|
||||
|
|
@ -147,7 +147,6 @@ func (s *sqlDatabase) listEntityPools(ctx context.Context, entityType params.Poo
|
|||
Where(condition, entityID).
|
||||
Omit("extra_specs").
|
||||
Find(&pools).Error
|
||||
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return []Pool{}, nil
|
||||
|
|
@ -210,7 +209,7 @@ func (s *sqlDatabase) findPoolByTags(id string, poolType params.PoolType, tags [
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) FindPoolsMatchingAllTags(ctx context.Context, entityType params.PoolType, entityID string, tags []string) ([]params.Pool, error) {
|
||||
func (s *sqlDatabase) FindPoolsMatchingAllTags(_ context.Context, entityType params.PoolType, entityID string, tags []string) ([]params.Pool, error) {
|
||||
if len(tags) == 0 {
|
||||
return nil, runnerErrors.NewBadRequestError("missing tags")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ import (
|
|||
"regexp"
|
||||
"testing"
|
||||
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"gopkg.in/DATA-DOG/go-sqlmock.v1"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
type PoolsTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (s *sqlDatabase) CreateRepository(ctx context.Context, owner, name, credentialsName, webhookSecret string) (params.Repository, error) {
|
||||
func (s *sqlDatabase) CreateRepository(_ context.Context, owner, name, credentialsName, webhookSecret string) (params.Repository, error) {
|
||||
if webhookSecret == "" {
|
||||
return params.Repository{}, errors.New("creating repo: missing secret")
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ func (s *sqlDatabase) GetRepository(ctx context.Context, owner, name string) (pa
|
|||
return param, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) ListRepositories(ctx context.Context) ([]params.Repository, error) {
|
||||
func (s *sqlDatabase) ListRepositories(_ context.Context) ([]params.Repository, error) {
|
||||
var repos []Repository
|
||||
q := s.conn.Find(&repos)
|
||||
if q.Error != nil {
|
||||
|
|
@ -146,12 +146,12 @@ func (s *sqlDatabase) GetRepositoryByID(ctx context.Context, repoID string) (par
|
|||
return param, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) CreateRepositoryPool(ctx context.Context, repoId string, param params.CreatePoolParams) (params.Pool, error) {
|
||||
func (s *sqlDatabase) CreateRepositoryPool(ctx context.Context, repoID string, param params.CreatePoolParams) (params.Pool, error) {
|
||||
if len(param.Tags) == 0 {
|
||||
return params.Pool{}, runnerErrors.NewBadRequestError("no tags specified")
|
||||
}
|
||||
|
||||
repo, err := s.getRepoByID(ctx, repoId)
|
||||
repo, err := s.getRepoByID(ctx, repoID)
|
||||
if err != nil {
|
||||
return params.Pool{}, errors.Wrap(err, "fetching repo")
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ func (s *sqlDatabase) CreateRepositoryPool(ctx context.Context, repoId string, p
|
|||
newPool.ExtraSpecs = datatypes.JSON(param.ExtraSpecs)
|
||||
}
|
||||
|
||||
_, err = s.getRepoPoolByUniqueFields(ctx, repoId, newPool.ProviderName, newPool.Image, newPool.Flavor)
|
||||
_, err = s.getRepoPoolByUniqueFields(ctx, repoID, newPool.ProviderName, newPool.Image, newPool.Flavor)
|
||||
if err != nil {
|
||||
if !errors.Is(err, runnerErrors.ErrNotFound) {
|
||||
return params.Pool{}, errors.Wrap(err, "creating pool")
|
||||
|
|
@ -249,7 +249,7 @@ func (s *sqlDatabase) DeleteRepositoryPool(ctx context.Context, repoID, poolID s
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) FindRepositoryPoolByTags(ctx context.Context, repoID string, tags []string) (params.Pool, error) {
|
||||
func (s *sqlDatabase) FindRepositoryPoolByTags(_ context.Context, repoID string, tags []string) (params.Pool, error) {
|
||||
pool, err := s.findPoolByTags(repoID, params.RepositoryPool, tags)
|
||||
if err != nil {
|
||||
return params.Pool{}, errors.Wrap(err, "fetching pool")
|
||||
|
|
@ -285,7 +285,7 @@ func (s *sqlDatabase) UpdateRepositoryPool(ctx context.Context, repoID, poolID s
|
|||
return s.updatePool(pool, param)
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getRepo(ctx context.Context, owner, name string) (Repository, error) {
|
||||
func (s *sqlDatabase) getRepo(_ context.Context, owner, name string) (Repository, error) {
|
||||
var repo Repository
|
||||
|
||||
q := s.conn.Where("name = ? COLLATE NOCASE and owner = ? COLLATE NOCASE", name, owner).
|
||||
|
|
@ -321,7 +321,7 @@ func (s *sqlDatabase) getRepoPoolByUniqueFields(ctx context.Context, repoID stri
|
|||
return pool[0], nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) getRepoByID(ctx context.Context, id string, preload ...string) (Repository, error) {
|
||||
func (s *sqlDatabase) getRepoByID(_ context.Context, id string, preload ...string) (Repository, error) {
|
||||
u, err := uuid.Parse(id)
|
||||
if err != nil {
|
||||
return Repository{}, errors.Wrap(runnerErrors.ErrBadRequest, "parsing id")
|
||||
|
|
|
|||
|
|
@ -22,15 +22,15 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"gopkg.in/DATA-DOG/go-sqlmock.v1"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
type RepoTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/gorm"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func (s *sqlDatabase) getUserByUsernameOrEmail(user string) (User, error) {
|
||||
|
|
@ -56,7 +56,7 @@ func (s *sqlDatabase) getUserByID(userID string) (User, error) {
|
|||
return dbUser, nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) CreateUser(ctx context.Context, user params.NewUserParams) (params.User, error) {
|
||||
func (s *sqlDatabase) CreateUser(_ context.Context, user params.NewUserParams) (params.User, error) {
|
||||
if user.Username == "" || user.Email == "" {
|
||||
return params.User{}, runnerErrors.NewBadRequestError("missing username or email")
|
||||
}
|
||||
|
|
@ -83,13 +83,13 @@ func (s *sqlDatabase) CreateUser(ctx context.Context, user params.NewUserParams)
|
|||
return s.sqlToParamsUser(newUser), nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) HasAdminUser(ctx context.Context) bool {
|
||||
func (s *sqlDatabase) HasAdminUser(_ context.Context) bool {
|
||||
var user User
|
||||
q := s.conn.Model(&User{}).Where("is_admin = ?", true).First(&user)
|
||||
return q.Error == nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) GetUser(ctx context.Context, user string) (params.User, error) {
|
||||
func (s *sqlDatabase) GetUser(_ context.Context, user string) (params.User, error) {
|
||||
dbUser, err := s.getUserByUsernameOrEmail(user)
|
||||
if err != nil {
|
||||
return params.User{}, errors.Wrap(err, "fetching user")
|
||||
|
|
@ -97,7 +97,7 @@ func (s *sqlDatabase) GetUser(ctx context.Context, user string) (params.User, er
|
|||
return s.sqlToParamsUser(dbUser), nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) GetUserByID(ctx context.Context, userID string) (params.User, error) {
|
||||
func (s *sqlDatabase) GetUserByID(_ context.Context, userID string) (params.User, error) {
|
||||
dbUser, err := s.getUserByID(userID)
|
||||
if err != nil {
|
||||
return params.User{}, errors.Wrap(err, "fetching user")
|
||||
|
|
@ -105,7 +105,7 @@ func (s *sqlDatabase) GetUserByID(ctx context.Context, userID string) (params.Us
|
|||
return s.sqlToParamsUser(dbUser), nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) UpdateUser(ctx context.Context, user string, param params.UpdateUserParams) (params.User, error) {
|
||||
func (s *sqlDatabase) UpdateUser(_ context.Context, user string, param params.UpdateUserParams) (params.User, error) {
|
||||
dbUser, err := s.getUserByUsernameOrEmail(user)
|
||||
if err != nil {
|
||||
return params.User{}, errors.Wrap(err, "fetching user")
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@ import (
|
|||
"regexp"
|
||||
"testing"
|
||||
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"gopkg.in/DATA-DOG/go-sqlmock.v1"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
type UserTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,13 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
func (s *sqlDatabase) sqlToParamsInstance(instance Instance) (params.Instance, error) {
|
||||
|
|
|
|||
|
|
@ -23,14 +23,12 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/cloudbase/garm/config"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cloudbase/garm/config"
|
||||
)
|
||||
|
||||
var (
|
||||
encryptionPassphrase = "bocyasicgatEtenOubwonIbsudNutDom"
|
||||
)
|
||||
var encryptionPassphrase = "bocyasicgatEtenOubwonIbsudNutDom"
|
||||
|
||||
func GetTestSqliteDBConfig(t *testing.T) config.Database {
|
||||
dir, err := os.MkdirTemp("", "garm-config-test")
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ import (
|
|||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner/common"
|
||||
"github.com/cloudbase/garm/util/appdefaults"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (r *Runner) CreateEnterprise(ctx context.Context, param params.CreateEnterpriseParams) (enterprise params.Enterprise, err error) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/config"
|
||||
|
|
@ -29,9 +32,6 @@ import (
|
|||
"github.com/cloudbase/garm/runner/common"
|
||||
runnerCommonMocks "github.com/cloudbase/garm/runner/common/mocks"
|
||||
runnerMocks "github.com/cloudbase/garm/runner/mocks"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type EnterpriseTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ import (
|
|||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/cloudbase/garm-provider-common/defaults"
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var systemdUnitTemplate = `[Unit]
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ import (
|
|||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner/common"
|
||||
"github.com/cloudbase/garm/util/appdefaults"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (r *Runner) CreateOrganization(ctx context.Context, param params.CreateOrgParams) (org params.Organization, err error) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/config"
|
||||
|
|
@ -29,9 +32,6 @@ import (
|
|||
"github.com/cloudbase/garm/runner/common"
|
||||
runnerCommonMocks "github.com/cloudbase/garm/runner/common/mocks"
|
||||
runnerMocks "github.com/cloudbase/garm/runner/mocks"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type OrgTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (r *Runner) ListAllPools(ctx context.Context) ([]params.Pool, error) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/config"
|
||||
|
|
@ -27,7 +29,6 @@ import (
|
|||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner/common"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type PoolTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ import (
|
|||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner/common"
|
||||
"github.com/cloudbase/garm/util/appdefaults"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (r *Runner) CreateRepository(ctx context.Context, param params.CreateRepoParams) (repo params.Repository, err error) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/config"
|
||||
|
|
@ -29,9 +32,6 @@ import (
|
|||
"github.com/cloudbase/garm/runner/common"
|
||||
runnerCommonMocks "github.com/cloudbase/garm/runner/common/mocks"
|
||||
runnerMocks "github.com/cloudbase/garm/runner/mocks"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type RepoTestFixtures struct {
|
||||
|
|
|
|||
|
|
@ -29,9 +29,16 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
"github.com/google/uuid"
|
||||
"github.com/juju/clock"
|
||||
"github.com/juju/retry"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/config"
|
||||
|
|
@ -40,12 +47,6 @@ import (
|
|||
"github.com/cloudbase/garm/runner/common"
|
||||
"github.com/cloudbase/garm/runner/pool"
|
||||
"github.com/cloudbase/garm/runner/providers"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/juju/clock"
|
||||
"github.com/juju/retry"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func NewRunner(ctx context.Context, cfg config.Config, db dbCommon.Store) (*Runner, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue