Skip to content

Commit 14ca086

Browse files
committed
graph/db: skip TestGraphLoading for non-bbolt store
Let all the NewTestDB functions return the V1Store interface type instead of pointers. Then add a manual skip in the TestGraphLoading test for any non-bbolt backend. We can remove this once all the methods used by the test have been implemented by the SQLStore. We only need the manual skip for this one test since it is the only one that doesnt use MakeGraphTest to init the graph db.
1 parent cbdd1c2 commit 14ca086

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

graph/db/graph_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4232,6 +4232,15 @@ func TestGraphLoading(t *testing.T) {
42324232
// Next, create the graph for the first time.
42334233
graphStore := NewTestDB(t)
42344234

4235+
// Temporarily add a manual skip for this test, until all the methods
4236+
// it uses have been implemented on the SQLStore struct. We have to
4237+
// manually add this skip because it is the only test that doesn't use
4238+
// the MakeTestGraph helper to create the graph store.
4239+
_, ok := graphStore.(*KVStore)
4240+
if !ok {
4241+
t.Skipf("Skipping TestGraphLoading for non-bbolt graph store")
4242+
}
4243+
42354244
graph, err := NewChannelGraph(graphStore)
42364245
require.NoError(t, err)
42374246
require.NoError(t, graph.Start())

graph/db/test_kvdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// NewTestDB is a helper function that creates an BBolt database for testing.
13-
func NewTestDB(t testing.TB) *KVStore {
13+
func NewTestDB(t testing.TB) V1Store {
1414
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
1515
require.NoError(t, err)
1616

graph/db/test_postgres.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
// NewTestDB is a helper function that creates a SQLStore backed by a postgres
1515
// database for testing. At the moment, it embeds a KVStore but once the
1616
// SQLStore fully implements the V1Store interface, the KVStore will be removed.
17-
func NewTestDB(t testing.TB) *SQLStore {
17+
func NewTestDB(t testing.TB) V1Store {
1818
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
1919
require.NoError(t, err)
2020

graph/db/test_sqlite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
// NewTestDB is a helper function that creates a SQLStore backed by a sqlite
1515
// database for testing. At the moment, it embeds a KVStore but once the
1616
// SQLStore fully implements the V1Store interface, the KVStore will be removed.
17-
func NewTestDB(t testing.TB) *SQLStore {
17+
func NewTestDB(t testing.TB) V1Store {
1818
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
1919
require.NoError(t, err)
2020

0 commit comments

Comments
 (0)