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.
This commit is contained in:
Elle Mouton committed 2025-05-22 14:14:42 +02:00
1 parent 7288f280f6
commit 7a348e324d
1 file changed
+4 -11
+4 -11
View File
@@ -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() {