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.
This commit is contained in:
Elle Mouton committed 2026-02-13 07:21:21 +02:00
1 parent c281810ab9
commit d8337be968
3 files changed
+9

No files matched your search

+3
View File
@@ -9,6 +9,9 @@ import (
"github.com/stretchr/testify/require"
)
// isSQLDB indicates that this build does not use a SQL database.
var isSQLDB = false
// NewTestDB is a helper function that creates an BBolt database for testing.
func NewTestDB(t testing.TB) Store {
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
+3
View File
@@ -11,6 +11,9 @@ import (
"github.com/stretchr/testify/require"
)
// isSQLDB indicates that this build uses a SQL database.
var isSQLDB = true
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
// database for testing.
func NewTestDB(t testing.TB) Store {
+3
View File
@@ -11,6 +11,9 @@ import (
"github.com/stretchr/testify/require"
)
// isSQLDB indicates that this build uses a SQL database.
var isSQLDB = true
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
// database for testing.
func NewTestDB(t testing.TB) Store {