Skip to content

Commit 6e9b448

Browse files
committed
graph/db: add helper variable for tests
Add an isSQLDB variable that will let us quickly check in tests if the backing DB is KVStore or SQLStore.
1 parent 726dca6 commit 6e9b448

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

graph/db/test_kvdb.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import (
99
"github.com/stretchr/testify/require"
1010
)
1111

12+
// isSQLDB indicates that this build does not use a SQL database.
13+
var isSQLDB = false
14+
1215
// NewTestDB is a helper function that creates an BBolt database for testing.
1316
func NewTestDB(t testing.TB) Store {
1417
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")

graph/db/test_postgres.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111
"github.com/stretchr/testify/require"
1212
)
1313

14+
// isSQLDB indicates that this build uses a SQL database.
15+
var isSQLDB = true
16+
1417
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
1518
// database for testing.
1619
func NewTestDB(t testing.TB) Store {

graph/db/test_sqlite.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111
"github.com/stretchr/testify/require"
1212
)
1313

14+
// isSQLDB indicates that this build uses a SQL database.
15+
var isSQLDB = true
16+
1417
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
1518
// database for testing.
1619
func NewTestDB(t testing.TB) Store {

0 commit comments

Comments
 (0)