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:
3 files changed
+9
No files matched your search
@@ -9,6 +9,9 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"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.
|
// NewTestDB is a helper function that creates an BBolt database for testing.
|
||||||
func NewTestDB(t testing.TB) Store {
|
func NewTestDB(t testing.TB) Store {
|
||||||
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
|
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"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
|
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
|
||||||
// database for testing.
|
// database for testing.
|
||||||
func NewTestDB(t testing.TB) Store {
|
func NewTestDB(t testing.TB) Store {
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"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
|
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
|
||||||
// database for testing.
|
// database for testing.
|
||||||
func NewTestDB(t testing.TB) Store {
|
func NewTestDB(t testing.TB) Store {
|
||||||
|
|||||||
Reference in new issue
Block a user