fix: godoc linter findings (TODO comments)
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
This commit is contained in:
parent
ee3a670456
commit
fd0550eb7f
6 changed files with 20 additions and 11 deletions
|
|
@ -233,6 +233,7 @@ func (r *Runner) DeleteEnterprisePool(ctx context.Context, enterpriseID, poolID
|
|||
return runnerErrors.ErrUnauthorized
|
||||
}
|
||||
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: dedup instance count verification
|
||||
pool, err := r.store.GetEnterprisePool(ctx, enterpriseID, poolID)
|
||||
if err != nil {
|
||||
|
|
@ -244,6 +245,7 @@ func (r *Runner) DeleteEnterprisePool(ctx context.Context, enterpriseID, poolID
|
|||
return errors.Wrap(err, "fetching instances")
|
||||
}
|
||||
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: implement a count function
|
||||
if len(instances) > 0 {
|
||||
runnerIDs := []string{}
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ func (r *Runner) DeleteOrganization(ctx context.Context, orgID string, keepWebho
|
|||
}
|
||||
|
||||
if err := poolMgr.UninstallWebhook(ctx); err != nil {
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO(gabriel-samfira): Should we error out here?
|
||||
slog.With(slog.Any("error", err)).ErrorContext(
|
||||
ctx, "failed to uninstall webhook",
|
||||
|
|
@ -261,6 +262,7 @@ func (r *Runner) DeleteOrgPool(ctx context.Context, orgID, poolID string) error
|
|||
return runnerErrors.ErrUnauthorized
|
||||
}
|
||||
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: dedup instance count verification
|
||||
pool, err := r.store.GetOrganizationPool(ctx, orgID, poolID)
|
||||
if err != nil {
|
||||
|
|
@ -272,6 +274,7 @@ func (r *Runner) DeleteOrgPool(ctx context.Context, orgID, poolID string) error
|
|||
return errors.Wrap(err, "fetching instances")
|
||||
}
|
||||
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: implement a count function
|
||||
if len(instances) > 0 {
|
||||
runnerIDs := []string{}
|
||||
|
|
|
|||
|
|
@ -110,13 +110,14 @@ func (r *Runner) UpdatePoolByID(ctx context.Context, poolID string, param params
|
|||
|
||||
var newPool params.Pool
|
||||
|
||||
if pool.RepoID != "" {
|
||||
switch {
|
||||
case pool.RepoID != "":
|
||||
newPool, err = r.store.UpdateRepositoryPool(ctx, pool.RepoID, poolID, param)
|
||||
} else if pool.OrgID != "" {
|
||||
case pool.OrgID != "":
|
||||
newPool, err = r.store.UpdateOrganizationPool(ctx, pool.OrgID, poolID, param)
|
||||
} else if pool.EnterpriseID != "" {
|
||||
case pool.EnterpriseID != "":
|
||||
newPool, err = r.store.UpdateEnterprisePool(ctx, pool.EnterpriseID, poolID, param)
|
||||
} else {
|
||||
default:
|
||||
return params.Pool{}, fmt.Errorf("pool not found to a repo, org or enterprise")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ func (s *PoolTestSuite) TestTestUpdatePoolByIDInvalidPoolID() {
|
|||
|
||||
func (s *PoolTestSuite) TestTestUpdatePoolByIDRunnerBootstrapTimeoutFailed() {
|
||||
// this is already created in `SetupTest()`
|
||||
var RunnerBootstrapTimeout uint = 0
|
||||
var RunnerBootstrapTimeout uint // default is 0
|
||||
s.Fixtures.UpdatePoolParams.RunnerBootstrapTimeout = &RunnerBootstrapTimeout
|
||||
|
||||
_, err := s.Runner.UpdatePoolByID(s.Fixtures.AdminContext, s.Fixtures.Pools[0].ID, s.Fixtures.UpdatePoolParams)
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ func (r *Runner) DeleteRepository(ctx context.Context, repoID string, keepWebhoo
|
|||
}
|
||||
|
||||
if err := poolMgr.UninstallWebhook(ctx); err != nil {
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO(gabriel-samfira): Should we error out here?
|
||||
slog.With(slog.Any("error", err)).ErrorContext(
|
||||
ctx, "failed to uninstall webhook",
|
||||
|
|
@ -270,6 +271,7 @@ func (r *Runner) DeleteRepoPool(ctx context.Context, repoID, poolID string) erro
|
|||
return errors.Wrap(err, "fetching instances")
|
||||
}
|
||||
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: implement a count function
|
||||
if len(instances) > 0 {
|
||||
runnerIDs := []string{}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ func (p *poolManagerCtrl) CreateRepoPoolManager(ctx context.Context, repo params
|
|||
return poolManager, nil
|
||||
}
|
||||
|
||||
func (p *poolManagerCtrl) UpdateRepoPoolManager(ctx context.Context, repo params.Repository) (common.PoolManager, error) {
|
||||
func (p *poolManagerCtrl) UpdateRepoPoolManager(_ context.Context, repo params.Repository) (common.PoolManager, error) {
|
||||
p.mux.Lock()
|
||||
defer p.mux.Unlock()
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ func (p *poolManagerCtrl) CreateOrgPoolManager(ctx context.Context, org params.O
|
|||
return poolManager, nil
|
||||
}
|
||||
|
||||
func (p *poolManagerCtrl) UpdateOrgPoolManager(ctx context.Context, org params.Organization) (common.PoolManager, error) {
|
||||
func (p *poolManagerCtrl) UpdateOrgPoolManager(_ context.Context, org params.Organization) (common.PoolManager, error) {
|
||||
p.mux.Lock()
|
||||
defer p.mux.Unlock()
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ func (p *poolManagerCtrl) CreateEnterprisePoolManager(ctx context.Context, enter
|
|||
return poolManager, nil
|
||||
}
|
||||
|
||||
func (p *poolManagerCtrl) UpdateEnterprisePoolManager(ctx context.Context, enterprise params.Enterprise) (common.PoolManager, error) {
|
||||
func (p *poolManagerCtrl) UpdateEnterprisePoolManager(_ context.Context, enterprise params.Enterprise) (common.PoolManager, error) {
|
||||
p.mux.Lock()
|
||||
defer p.mux.Unlock()
|
||||
|
||||
|
|
@ -903,7 +903,8 @@ func (r *Runner) getPoolManagerFromInstance(ctx context.Context, instance params
|
|||
|
||||
var poolMgr common.PoolManager
|
||||
|
||||
if pool.RepoID != "" {
|
||||
switch {
|
||||
case pool.RepoID != "":
|
||||
repo, err := r.store.GetRepositoryByID(ctx, pool.RepoID)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "fetching repo")
|
||||
|
|
@ -912,7 +913,7 @@ func (r *Runner) getPoolManagerFromInstance(ctx context.Context, instance params
|
|||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "fetching pool manager for repo %s", pool.RepoName)
|
||||
}
|
||||
} else if pool.OrgID != "" {
|
||||
case pool.OrgID != "":
|
||||
org, err := r.store.GetOrganizationByID(ctx, pool.OrgID)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "fetching org")
|
||||
|
|
@ -921,7 +922,7 @@ func (r *Runner) getPoolManagerFromInstance(ctx context.Context, instance params
|
|||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "fetching pool manager for org %s", pool.OrgName)
|
||||
}
|
||||
} else if pool.EnterpriseID != "" {
|
||||
case pool.EnterpriseID != "":
|
||||
enterprise, err := r.store.GetEnterpriseByID(ctx, pool.EnterpriseID)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "fetching enterprise")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue