Skip to content

Commit

Permalink
update some extra db configs
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Jul 21, 2023
1 parent bdd8a04 commit cdb000f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions database/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package database

import (
"github.com/go-vela/server/database/build"
"github.com/go-vela/server/database/executable"
"github.com/go-vela/server/database/hook"
"github.com/go-vela/server/database/log"
"github.com/go-vela/server/database/pipeline"
Expand All @@ -32,6 +33,17 @@ func (e *engine) NewResources() error {
return err
}

// create the database agnostic engine for build_executables
e.BuildExecutableInterface, err = executable.New(
executable.WithClient(e.client),
executable.WithLogger(e.logger),
executable.WithSkipCreation(e.config.SkipCreation),
executable.WithDriver(e.config.Driver),
)
if err != nil {
return err
}

// create the database agnostic engine for hooks
e.HookInterface, err = hook.New(
hook.WithClient(e.client),
Expand Down
3 changes: 3 additions & 0 deletions database/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/DATA-DOG/go-sqlmock"
"github.com/go-vela/server/database/build"
"github.com/go-vela/server/database/executable"
"github.com/go-vela/server/database/hook"
"github.com/go-vela/server/database/log"
"github.com/go-vela/server/database/pipeline"
Expand All @@ -31,6 +32,8 @@ func TestDatabase_Engine_NewResources(t *testing.T) {
_mock.ExpectExec(build.CreateRepoIDIndex).WillReturnResult(sqlmock.NewResult(1, 1))
_mock.ExpectExec(build.CreateSourceIndex).WillReturnResult(sqlmock.NewResult(1, 1))
_mock.ExpectExec(build.CreateStatusIndex).WillReturnResult(sqlmock.NewResult(1, 1))
// ensure the mock expects the build executable queries
_mock.ExpectExec(executable.CreatePostgresTable).WillReturnResult(sqlmock.NewResult(1, 1))
// ensure the mock expects the hook queries
_mock.ExpectExec(hook.CreatePostgresTable).WillReturnResult(sqlmock.NewResult(1, 1))
_mock.ExpectExec(hook.CreateRepoIDIndex).WillReturnResult(sqlmock.NewResult(1, 1))
Expand Down

0 comments on commit cdb000f

Please sign in to comment.