Skip to content

Commit 3ccaacd

Browse files
committed
multi: rename MakeTestGraphNew to MakeTestGraph
1 parent c06036d commit 3ccaacd

File tree

7 files changed

+46
-46
lines changed

7 files changed

+46
-46
lines changed

autopilot/prefattach_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type testDBGraph struct {
3636
}
3737

3838
func newDiskChanGraph(t *testing.T) (testGraph, error) {
39-
graphDB := graphdb.MakeTestGraphNew(t)
39+
graphDB := graphdb.MakeTestGraph(t)
4040
require.NoError(t, graphDB.Start())
4141
t.Cleanup(func() {
4242
require.NoError(t, graphDB.Stop())

graph/builder_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ func parseTestGraph(t *testing.T, useCache bool, path string) (
13751375
testAddrs = append(testAddrs, testAddr)
13761376

13771377
// Next, create a temporary graph database for usage within the test.
1378-
graph := graphdb.MakeTestGraphNew(
1378+
graph := graphdb.MakeTestGraph(
13791379
t, graphdb.WithUseGraphCache(useCache),
13801380
)
13811381

@@ -1753,7 +1753,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
17531753
testAddrs = append(testAddrs, testAddr)
17541754

17551755
// Next, create a temporary graph database for usage within the test.
1756-
graph := graphdb.MakeTestGraphNew(
1756+
graph := graphdb.MakeTestGraph(
17571757
t, graphdb.WithUseGraphCache(useCache),
17581758
)
17591759

graph/db/graph.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ func (c *ChannelGraph) UpdateEdgePolicy(ctx context.Context,
594594
return nil
595595
}
596596

597-
// MakeTestGraphNew creates a new instance of the ChannelGraph for testing
597+
// MakeTestGraph creates a new instance of the ChannelGraph for testing
598598
// purposes. The backing V1Store implementation depends on the version of
599599
// NewTestDB included in the current build.
600600
//
@@ -603,7 +603,7 @@ func (c *ChannelGraph) UpdateEdgePolicy(ctx context.Context,
603603
// implemented, unit tests will be switched to use this function instead of
604604
// the existing MakeTestGraph helper. Once only this function is used, the
605605
// existing MakeTestGraph function will be removed and this one will be renamed.
606-
func MakeTestGraphNew(t testing.TB,
606+
func MakeTestGraph(t testing.TB,
607607
opts ...ChanGraphOption) *ChannelGraph {
608608

609609
t.Helper()

graph/db/graph_test.go

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
101101
t.Parallel()
102102
ctx := context.Background()
103103

104-
graph := MakeTestGraphNew(t)
104+
graph := MakeTestGraph(t)
105105

106106
// We'd like to test basic insertion/deletion for vertexes from the
107107
// graph, so we'll create a test vertex to start with.
@@ -264,7 +264,7 @@ func TestPartialNode(t *testing.T) {
264264
t.Parallel()
265265
ctx := context.Background()
266266

267-
graph := MakeTestGraphNew(t)
267+
graph := MakeTestGraph(t)
268268

269269
// To insert a partial node, we need to add a channel edge that has
270270
// node keys for nodes we are not yet aware
@@ -332,7 +332,7 @@ func TestAliasLookup(t *testing.T) {
332332
t.Parallel()
333333
ctx := context.Background()
334334

335-
graph := MakeTestGraphNew(t)
335+
graph := MakeTestGraph(t)
336336

337337
// We'd like to test the alias index within the database, so first
338338
// create a new test node.
@@ -363,7 +363,7 @@ func TestSourceNode(t *testing.T) {
363363
t.Parallel()
364364
ctx := context.Background()
365365

366-
graph := MakeTestGraphNew(t)
366+
graph := MakeTestGraph(t)
367367

368368
// We'd like to test the setting/getting of the source node, so we
369369
// first create a fake node to use within the test.
@@ -390,7 +390,7 @@ func TestEdgeInsertionDeletion(t *testing.T) {
390390
t.Parallel()
391391
ctx := context.Background()
392392

393-
graph := MakeTestGraphNew(t)
393+
graph := MakeTestGraph(t)
394394

395395
// We'd like to test the insertion/deletion of edges, so we create two
396396
// vertexes to connect.
@@ -513,7 +513,7 @@ func TestDisconnectBlockAtHeight(t *testing.T) {
513513
t.Parallel()
514514
ctx := context.Background()
515515

516-
graph := MakeTestGraphNew(t)
516+
graph := MakeTestGraph(t)
517517

518518
sourceNode := createTestVertex(t)
519519
if err := graph.SetSourceNode(ctx, sourceNode); err != nil {
@@ -810,7 +810,7 @@ func TestEdgeInfoUpdates(t *testing.T) {
810810
t.Parallel()
811811
ctx := context.Background()
812812

813-
graph := MakeTestGraphNew(t)
813+
graph := MakeTestGraph(t)
814814

815815
// We'd like to test the update of edges inserted into the database, so
816816
// we create two vertexes to connect.
@@ -1128,7 +1128,7 @@ func TestAddEdgeProof(t *testing.T) {
11281128
t.Parallel()
11291129
ctx := context.Background()
11301130

1131-
graph := MakeTestGraphNew(t)
1131+
graph := MakeTestGraph(t)
11321132

11331133
// Add an edge with no proof.
11341134
node1 := createTestVertex(t)
@@ -1187,7 +1187,7 @@ func TestForEachSourceNodeChannel(t *testing.T) {
11871187
t.Parallel()
11881188
ctx := context.Background()
11891189

1190-
graph := MakeTestGraphNew(t)
1190+
graph := MakeTestGraph(t)
11911191

11921192
// Create a source node (A) and set it as such in the DB.
11931193
nodeA := createTestVertex(t)
@@ -1275,7 +1275,7 @@ func TestForEachSourceNodeChannel(t *testing.T) {
12751275
func TestGraphTraversal(t *testing.T) {
12761276
t.Parallel()
12771277

1278-
graph := MakeTestGraphNew(t)
1278+
graph := MakeTestGraph(t)
12791279

12801280
// We'd like to test some of the graph traversal capabilities within
12811281
// the DB, so we'll create a series of fake nodes to insert into the
@@ -1370,7 +1370,7 @@ func TestGraphTraversal(t *testing.T) {
13701370
func TestGraphTraversalCacheable(t *testing.T) {
13711371
t.Parallel()
13721372

1373-
graph := MakeTestGraphNew(t)
1373+
graph := MakeTestGraph(t)
13741374

13751375
// We'd like to test some of the graph traversal capabilities within
13761376
// the DB, so we'll create a series of fake nodes to insert into the
@@ -1440,7 +1440,7 @@ func TestGraphTraversalCacheable(t *testing.T) {
14401440
func TestGraphCacheTraversal(t *testing.T) {
14411441
t.Parallel()
14421442

1443-
graph := MakeTestGraphNew(t)
1443+
graph := MakeTestGraph(t)
14441444

14451445
// We'd like to test some of the graph traversal capabilities within
14461446
// the DB, so we'll create a series of fake nodes to insert into the
@@ -1685,7 +1685,7 @@ func TestGraphPruning(t *testing.T) {
16851685
t.Parallel()
16861686
ctx := context.Background()
16871687

1688-
graph := MakeTestGraphNew(t)
1688+
graph := MakeTestGraph(t)
16891689

16901690
sourceNode := createTestVertex(t)
16911691
if err := graph.SetSourceNode(ctx, sourceNode); err != nil {
@@ -1875,7 +1875,7 @@ func TestHighestChanID(t *testing.T) {
18751875
t.Parallel()
18761876
ctx := context.Background()
18771877

1878-
graph := MakeTestGraphNew(t)
1878+
graph := MakeTestGraph(t)
18791879

18801880
// If we don't yet have any channels in the database, then we should
18811881
// get a channel ID of zero if we ask for the highest channel ID.
@@ -1935,7 +1935,7 @@ func TestChanUpdatesInHorizon(t *testing.T) {
19351935
t.Parallel()
19361936
ctx := context.Background()
19371937

1938-
graph := MakeTestGraphNew(t)
1938+
graph := MakeTestGraph(t)
19391939

19401940
// If we issue an arbitrary query before any channel updates are
19411941
// inserted in the database, we should get zero results.
@@ -2093,7 +2093,7 @@ func TestNodeUpdatesInHorizon(t *testing.T) {
20932093
t.Parallel()
20942094
ctx := context.Background()
20952095

2096-
graph := MakeTestGraphNew(t)
2096+
graph := MakeTestGraph(t)
20972097

20982098
startTime := time.Unix(1234, 0)
20992099
endTime := startTime
@@ -2196,7 +2196,7 @@ func TestNodeUpdatesInHorizon(t *testing.T) {
21962196
func TestFilterKnownChanIDsZombieRevival(t *testing.T) {
21972197
t.Parallel()
21982198

2199-
graph := MakeTestGraphNew(t)
2199+
graph := MakeTestGraph(t)
22002200

22012201
var (
22022202
scid1 = lnwire.ShortChannelID{BlockHeight: 1}
@@ -2262,7 +2262,7 @@ func TestFilterKnownChanIDs(t *testing.T) {
22622262
t.Parallel()
22632263
ctx := context.Background()
22642264

2265-
graph := MakeTestGraphNew(t)
2265+
graph := MakeTestGraph(t)
22662266

22672267
isZombieUpdate := func(updateTime1 time.Time,
22682268
updateTime2 time.Time) bool {
@@ -2440,7 +2440,7 @@ func TestStressTestChannelGraphAPI(t *testing.T) {
24402440
t.Parallel()
24412441
ctx := context.Background()
24422442

2443-
graph := MakeTestGraphNew(t)
2443+
graph := MakeTestGraph(t)
24442444

24452445
node1 := createTestVertex(t)
24462446
require.NoError(t, graph.AddLightningNode(ctx, node1))
@@ -2729,7 +2729,7 @@ func TestFilterChannelRange(t *testing.T) {
27292729
t.Parallel()
27302730
ctx := context.Background()
27312731

2732-
graph := MakeTestGraphNew(t)
2732+
graph := MakeTestGraph(t)
27332733

27342734
// We'll first populate our graph with two nodes. All channels created
27352735
// below will be made between these two nodes.
@@ -2948,7 +2948,7 @@ func TestFetchChanInfos(t *testing.T) {
29482948
t.Parallel()
29492949
ctx := context.Background()
29502950

2951-
graph := MakeTestGraphNew(t)
2951+
graph := MakeTestGraph(t)
29522952

29532953
// We'll first populate our graph with two nodes. All channels created
29542954
// below will be made between these two nodes.
@@ -3051,7 +3051,7 @@ func TestIncompleteChannelPolicies(t *testing.T) {
30513051
t.Parallel()
30523052
ctx := context.Background()
30533053

3054-
graph := MakeTestGraphNew(t)
3054+
graph := MakeTestGraph(t)
30553055

30563056
// Create two nodes.
30573057
node1 := createTestVertex(t)
@@ -3147,7 +3147,7 @@ func TestChannelEdgePruningUpdateIndexDeletion(t *testing.T) {
31473147
t.Parallel()
31483148
ctx := context.Background()
31493149

3150-
graph := MakeTestGraphNew(t)
3150+
graph := MakeTestGraph(t)
31513151

31523152
// The update index only applies to the bbolt graph.
31533153
boltStore, ok := graph.V1Store.(*KVStore)
@@ -3295,7 +3295,7 @@ func TestPruneGraphNodes(t *testing.T) {
32953295
t.Parallel()
32963296
ctx := context.Background()
32973297

3298-
graph := MakeTestGraphNew(t)
3298+
graph := MakeTestGraph(t)
32993299

33003300
// We'll start off by inserting our source node, to ensure that it's
33013301
// the only node left after we prune the graph.
@@ -3361,7 +3361,7 @@ func TestAddChannelEdgeShellNodes(t *testing.T) {
33613361
t.Parallel()
33623362
ctx := context.Background()
33633363

3364-
graph := MakeTestGraphNew(t)
3364+
graph := MakeTestGraph(t)
33653365

33663366
// To start, we'll create two nodes, and only add one of them to the
33673367
// channel graph.
@@ -3400,7 +3400,7 @@ func TestNodePruningUpdateIndexDeletion(t *testing.T) {
34003400
t.Parallel()
34013401
ctx := context.Background()
34023402

3403-
graph := MakeTestGraphNew(t)
3403+
graph := MakeTestGraph(t)
34043404

34053405
// We'll first populate our graph with a single node that will be
34063406
// removed shortly.
@@ -3469,19 +3469,19 @@ func TestNodeIsPublic(t *testing.T) {
34693469
// We'll need to create a separate database and channel graph for each
34703470
// participant to replicate real-world scenarios (private edges being in
34713471
// some graphs but not others, etc.).
3472-
aliceGraph := MakeTestGraphNew(t)
3472+
aliceGraph := MakeTestGraph(t)
34733473
aliceNode := createTestVertex(t)
34743474
if err := aliceGraph.SetSourceNode(ctx, aliceNode); err != nil {
34753475
t.Fatalf("unable to set source node: %v", err)
34763476
}
34773477

3478-
bobGraph := MakeTestGraphNew(t)
3478+
bobGraph := MakeTestGraph(t)
34793479
bobNode := createTestVertex(t)
34803480
if err := bobGraph.SetSourceNode(ctx, bobNode); err != nil {
34813481
t.Fatalf("unable to set source node: %v", err)
34823482
}
34833483

3484-
carolGraph := MakeTestGraphNew(t)
3484+
carolGraph := MakeTestGraph(t)
34853485
carolNode := createTestVertex(t)
34863486
if err := carolGraph.SetSourceNode(ctx, carolNode); err != nil {
34873487
t.Fatalf("unable to set source node: %v", err)
@@ -3596,7 +3596,7 @@ func TestDisabledChannelIDs(t *testing.T) {
35963596
t.Parallel()
35973597
ctx := context.Background()
35983598

3599-
graph := MakeTestGraphNew(t)
3599+
graph := MakeTestGraph(t)
36003600

36013601
// Create first node and add it to the graph.
36023602
node1 := createTestVertex(t)
@@ -3681,7 +3681,7 @@ func TestEdgePolicyMissingMaxHtcl(t *testing.T) {
36813681
t.Parallel()
36823682
ctx := context.Background()
36833683

3684-
graph := MakeTestGraphNew(t)
3684+
graph := MakeTestGraph(t)
36853685

36863686
// This test currently directly edits the bytes stored in the bbolt DB.
36873687
boltStore, ok := graph.V1Store.(*KVStore)
@@ -3828,7 +3828,7 @@ func TestGraphZombieIndex(t *testing.T) {
38283828
ctx := context.Background()
38293829

38303830
// We'll start by creating our test graph along with a test edge.
3831-
graph := MakeTestGraphNew(t)
3831+
graph := MakeTestGraph(t)
38323832

38333833
node1 := createTestVertex(t)
38343834
node2 := createTestVertex(t)
@@ -4010,7 +4010,7 @@ func TestBatchedAddChannelEdge(t *testing.T) {
40104010
t.Parallel()
40114011
ctx := context.Background()
40124012

4013-
graph := MakeTestGraphNew(t)
4013+
graph := MakeTestGraph(t)
40144014

40154015
sourceNode := createTestVertex(t)
40164016
require.Nil(t, graph.SetSourceNode(ctx, sourceNode))
@@ -4087,7 +4087,7 @@ func TestBatchedUpdateEdgePolicy(t *testing.T) {
40874087
t.Parallel()
40884088
ctx := context.Background()
40894089

4090-
graph := MakeTestGraphNew(t)
4090+
graph := MakeTestGraph(t)
40914091

40924092
// We'd like to test the update of edges inserted into the database, so
40934093
// we create two vertexes to connect.
@@ -4137,7 +4137,7 @@ func TestBatchedUpdateEdgePolicy(t *testing.T) {
41374137
// BenchmarkForEachChannel is a benchmark test that measures the number of
41384138
// allocations and the total memory consumed by the full graph traversal.
41394139
func BenchmarkForEachChannel(b *testing.B) {
4140-
graph := MakeTestGraphNew(b)
4140+
graph := MakeTestGraph(b)
41414141

41424142
const numNodes = 100
41434143
const numChannels = 4
@@ -4190,7 +4190,7 @@ func TestGraphCacheForEachNodeChannel(t *testing.T) {
41904190
t.Parallel()
41914191
ctx := context.Background()
41924192

4193-
graph := MakeTestGraphNew(t)
4193+
graph := MakeTestGraph(t)
41944194

41954195
// Unset the channel graph cache to simulate the user running with the
41964196
// option turned off.
@@ -4325,7 +4325,7 @@ func TestGraphLoading(t *testing.T) {
43254325
func TestClosedScid(t *testing.T) {
43264326
t.Parallel()
43274327

4328-
graph := MakeTestGraphNew(t)
4328+
graph := MakeTestGraph(t)
43294329

43304330
scid := lnwire.ShortChannelID{}
43314331

@@ -4362,7 +4362,7 @@ func TestLightningNodePersistence(t *testing.T) {
43624362
ctx := context.Background()
43634363

43644364
// Create a new test graph instance.
4365-
graph := MakeTestGraphNew(t)
4365+
graph := MakeTestGraph(t)
43664366

43674367
nodeAnnBytes, err := hex.DecodeString(testNodeAnn)
43684368
require.NoError(t, err)

graph/notifications_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ type testCtx struct {
10591059
func createTestCtxSingleNode(t *testing.T,
10601060
startingHeight uint32) *testCtx {
10611061

1062-
graph := graphdb.MakeTestGraphNew(t)
1062+
graph := graphdb.MakeTestGraph(t)
10631063
sourceNode := createTestNode(t)
10641064

10651065
require.NoError(t,

0 commit comments

Comments
 (0)