From 7a348e324d196b3d5e403af1ff316423c732c4c0 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Fri, 9 May 2025 11:19:52 +0200 Subject: [PATCH] graph/db: let MakeTestGraph take ChanGraphOptions Currently none of the calls to MakeTestGraph make use of the KVStoreOptionModifier options but later on we will want to make use of the `WithUseGraphCache` ChannelGraphOption and so we take this opportunity to switch out the functional parameters that the helper function takes. --- graph/db/kv_store.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/graph/db/kv_store.go b/graph/db/kv_store.go index f7ebc241b..4e2bf7365 100644 --- a/graph/db/kv_store.go +++ b/graph/db/kv_store.go @@ -4707,16 +4707,9 @@ func (c *chanGraphNodeTx) ForEachChannel(f func(*models.ChannelEdgeInfo, ) } -// MakeTestGraph creates a new instance of the KVStore for testing +// MakeTestGraph creates a new instance of the ChannelGraph for testing // purposes. -func MakeTestGraph(t testing.TB, - modifiers ...KVStoreOptionModifier) *ChannelGraph { - - opts := DefaultOptions() - for _, modifier := range modifiers { - modifier(opts) - } - +func MakeTestGraph(t testing.TB, opts ...ChanGraphOption) *ChannelGraph { // Next, create KVStore for the first time. backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr") t.Cleanup(backendCleanup) @@ -4725,10 +4718,10 @@ func MakeTestGraph(t testing.TB, require.NoError(t, backend.Close()) }) - graphStore, err := NewKVStore(backend, modifiers...) + graphStore, err := NewKVStore(backend) require.NoError(t, err) - graph, err := NewChannelGraph(graphStore) + graph, err := NewChannelGraph(graphStore, opts...) require.NoError(t, err) require.NoError(t, graph.Start()) t.Cleanup(func() {