Fix database tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
5a93761af7
commit
f66f95baff
6 changed files with 52 additions and 8 deletions
|
|
@ -25,6 +25,7 @@ import (
|
|||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/database/common"
|
||||
"github.com/cloudbase/garm/database/watcher"
|
||||
garmTesting "github.com/cloudbase/garm/internal/testing"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
|
@ -37,7 +38,9 @@ type GiteaTestSuite struct {
|
|||
}
|
||||
|
||||
func (s *GiteaTestSuite) SetupTest() {
|
||||
db, err := NewSQLDatabase(context.Background(), garmTesting.GetTestSqliteDBConfig(s.T()))
|
||||
ctx := context.Background()
|
||||
watcher.InitWatcher(ctx)
|
||||
db, err := NewSQLDatabase(ctx, garmTesting.GetTestSqliteDBConfig(s.T()))
|
||||
if err != nil {
|
||||
s.FailNow(fmt.Sprintf("failed to create db connection: %s", err))
|
||||
}
|
||||
|
|
@ -50,13 +53,17 @@ func (s *GiteaTestSuite) SetupTest() {
|
|||
APIBaseURL: testAPIBaseURL,
|
||||
BaseURL: testBaseURL,
|
||||
}
|
||||
endpoint, err := s.db.CreateGiteaEndpoint(context.Background(), createEpParams)
|
||||
endpoint, err := s.db.CreateGiteaEndpoint(ctx, createEpParams)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NotNil(endpoint)
|
||||
s.Require().Equal(testEndpointName, endpoint.Name)
|
||||
s.giteaEndpoint = endpoint
|
||||
}
|
||||
|
||||
func (s *GiteaTestSuite) TearDownTest() {
|
||||
watcher.CloseWatcher()
|
||||
}
|
||||
|
||||
func (s *GiteaTestSuite) TestCreatingEndpoint() {
|
||||
ctx := garmTesting.ImpersonateAdminContext(context.Background(), s.db, s.T())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue