Cleanup unused struct field
Remove `Pool` field from `CreateInstanceParams` struct, because this is given as a separate parameter to the `CreateInstance` function.
This commit is contained in:
parent
775dd51782
commit
e2ada6d1e3
6 changed files with 1 additions and 11 deletions
|
|
@ -26,7 +26,7 @@ import (
|
|||
)
|
||||
|
||||
func (s *sqlDatabase) CreateInstance(ctx context.Context, poolID string, param params.CreateInstanceParams) (params.Instance, error) {
|
||||
pool, err := s.getPoolByID(ctx, param.Pool)
|
||||
pool, err := s.getPoolByID(ctx, poolID)
|
||||
if err != nil {
|
||||
return params.Instance{}, errors.Wrap(err, "fetching pool")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ func (s *InstancesTestSuite) SetupTest() {
|
|||
OSType: "linux",
|
||||
OSArch: "amd64",
|
||||
CallbackURL: "https://garm.example.com/",
|
||||
Pool: pool.ID,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -103,7 +102,6 @@ func (s *InstancesTestSuite) TestCreateInstance() {
|
|||
OSType: "linux",
|
||||
OSArch: "amd64",
|
||||
CallbackURL: "https://garm.example.com/",
|
||||
Pool: s.Fixtures.Pool.ID,
|
||||
}
|
||||
|
||||
// call tested function
|
||||
|
|
|
|||
|
|
@ -97,8 +97,6 @@ type CreateInstanceParams struct {
|
|||
RunnerStatus common.RunnerStatus
|
||||
CallbackURL string
|
||||
CreateAttempt int `json:"-"`
|
||||
|
||||
Pool string
|
||||
}
|
||||
|
||||
type CreatePoolParams struct {
|
||||
|
|
|
|||
|
|
@ -465,7 +465,6 @@ func (s *OrgTestSuite) TestDeleteOrgPoolRunnersFailed() {
|
|||
if err != nil {
|
||||
s.FailNow(fmt.Sprintf("cannot create org pool: %v", err))
|
||||
}
|
||||
s.Fixtures.CreateInstanceParams.Pool = pool.ID
|
||||
instance, err := s.Fixtures.Store.CreateInstance(s.Fixtures.AdminContext, pool.ID, s.Fixtures.CreateInstanceParams)
|
||||
if err != nil {
|
||||
s.FailNow(fmt.Sprintf("cannot create instance: %s", err))
|
||||
|
|
@ -539,7 +538,6 @@ func (s *OrgTestSuite) TestListOrgInstances() {
|
|||
s.FailNow(fmt.Sprintf("cannot create org pool: %v", err))
|
||||
}
|
||||
poolInstances := []params.Instance{}
|
||||
s.Fixtures.CreateInstanceParams.Pool = pool.ID
|
||||
for i := 1; i <= 3; i++ {
|
||||
s.Fixtures.CreateInstanceParams.Name = fmt.Sprintf("test-org-%v", i)
|
||||
instance, err := s.Fixtures.Store.CreateInstance(s.Fixtures.AdminContext, pool.ID, s.Fixtures.CreateInstanceParams)
|
||||
|
|
|
|||
|
|
@ -316,7 +316,6 @@ func (r *basePool) AddRunner(ctx context.Context, poolID string) error {
|
|||
|
||||
createParams := params.CreateInstanceParams{
|
||||
Name: name,
|
||||
Pool: poolID,
|
||||
Status: providerCommon.InstancePendingCreate,
|
||||
RunnerStatus: providerCommon.RunnerPending,
|
||||
OSArch: pool.OSArch,
|
||||
|
|
|
|||
|
|
@ -467,7 +467,6 @@ func (s *RepoTestSuite) TestDeleteRepoPoolRunnersFailed() {
|
|||
if err != nil {
|
||||
s.FailNow(fmt.Sprintf("cannot create repo pool: %s", err))
|
||||
}
|
||||
s.Fixtures.CreateInstanceParams.Pool = pool.ID
|
||||
instance, err := s.Fixtures.Store.CreateInstance(s.Fixtures.AdminContext, pool.ID, s.Fixtures.CreateInstanceParams)
|
||||
if err != nil {
|
||||
s.FailNow(fmt.Sprintf("cannot create instance: %s", err))
|
||||
|
|
@ -507,7 +506,6 @@ func (s *RepoTestSuite) TestListPoolInstances() {
|
|||
s.FailNow(fmt.Sprintf("cannot create repo pool: %v", err))
|
||||
}
|
||||
poolInstances := []params.Instance{}
|
||||
s.Fixtures.CreateInstanceParams.Pool = pool.ID
|
||||
for i := 1; i <= 3; i++ {
|
||||
s.Fixtures.CreateInstanceParams.Name = fmt.Sprintf("test-repo-%v", i)
|
||||
instance, err := s.Fixtures.Store.CreateInstance(s.Fixtures.AdminContext, pool.ID, s.Fixtures.CreateInstanceParams)
|
||||
|
|
@ -569,7 +567,6 @@ func (s *RepoTestSuite) TestListRepoInstances() {
|
|||
s.FailNow(fmt.Sprintf("cannot create repo pool: %v", err))
|
||||
}
|
||||
poolInstances := []params.Instance{}
|
||||
s.Fixtures.CreateInstanceParams.Pool = pool.ID
|
||||
for i := 1; i <= 3; i++ {
|
||||
s.Fixtures.CreateInstanceParams.Name = fmt.Sprintf("test-repo-%v", i)
|
||||
instance, err := s.Fixtures.Store.CreateInstance(s.Fixtures.AdminContext, pool.ID, s.Fixtures.CreateInstanceParams)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue