From d8337be9680cdef29d5b58a8d27252158d3c56ab Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Sun, 26 Oct 2025 17:09:41 +0200 Subject: [PATCH] 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. --- graph/db/test_kvdb.go | 3 +++ graph/db/test_postgres.go | 3 +++ graph/db/test_sqlite.go | 3 +++ 3 files changed, 9 insertions(+) diff --git a/graph/db/test_kvdb.go b/graph/db/test_kvdb.go index 569e0949f..22904f858 100644 --- a/graph/db/test_kvdb.go +++ b/graph/db/test_kvdb.go @@ -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") diff --git a/graph/db/test_postgres.go b/graph/db/test_postgres.go index 716210afa..a1bd61a2c 100644 --- a/graph/db/test_postgres.go +++ b/graph/db/test_postgres.go @@ -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 { diff --git a/graph/db/test_sqlite.go b/graph/db/test_sqlite.go index 68fef6eb9..137ab7aa9 100644 --- a/graph/db/test_sqlite.go +++ b/graph/db/test_sqlite.go @@ -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 {