@@ -130,6 +130,14 @@ var versionedTests = []versionedTest{
130130 name : "node crud" ,
131131 test : testNodeInsertionAndDeletion ,
132132 },
133+ {
134+ name : "source node" ,
135+ test : testSourceNode ,
136+ },
137+ {
138+ name : "alias lookup" ,
139+ test : testAliasLookup ,
140+ },
133141}
134142
135143// TestVersionedDBs runs various tests against both v1 and v2 versioned
@@ -415,16 +423,15 @@ func TestPartialNode(t *testing.T) {
415423 require .ErrorIs (t , err , ErrGraphNodeNotFound )
416424}
417425
418- // TestAliasLookup tests the alias lookup functionality of the graph store.
419- func TestAliasLookup (t * testing.T ) {
420- t .Parallel ()
426+ // testAliasLookup tests the alias lookup functionality of the graph store.
427+ func testAliasLookup (t * testing.T , v lnwire.GossipVersion ) {
421428 ctx := t .Context ()
422429
423- graph := MakeTestGraph (t )
430+ graph := NewVersionedReader ( MakeTestGraph (t ), v )
424431
425432 // We'd like to test the alias index within the database, so first
426433 // create a new test node.
427- testNode := createTestVertex (t , lnwire . GossipVersion1 )
434+ testNode := createTestVertex (t , v )
428435
429436 // Add the node to the graph's database, this should also insert an
430437 // entry into the alias index for this node.
@@ -439,23 +446,23 @@ func TestAliasLookup(t *testing.T) {
439446 require .Equal (t , testNode .Alias .UnwrapOr ("" ), dbAlias )
440447
441448 // Ensure that looking up a non-existent alias results in an error.
442- node := createTestVertex (t , lnwire . GossipVersion1 )
449+ node := createTestVertex (t , v )
443450 nodePub , err = node .PubKey ()
444451 require .NoError (t , err , "unable to generate pubkey" )
445452 _ , err = graph .LookupAlias (ctx , nodePub )
446453 require .ErrorIs (t , err , ErrNodeAliasNotFound )
447454}
448455
449- // TestSourceNode tests the source node functionality of the graph store.
450- func TestSourceNode (t * testing.T ) {
456+ // testSourceNode tests the source node functionality of the graph store.
457+ func testSourceNode (t * testing.T , v lnwire. GossipVersion ) {
451458 t .Parallel ()
452459 ctx := t .Context ()
453460
454- graph := MakeTestGraph (t )
461+ graph := NewVersionedReader ( MakeTestGraph (t ), v )
455462
456463 // We'd like to test the setting/getting of the source node, so we
457464 // first create a fake node to use within the test.
458- testNode := createTestVertex (t , lnwire . GossipVersion1 )
465+ testNode := createTestVertex (t , v )
459466
460467 // Attempt to fetch the source node, this should return an error as the
461468 // source node hasn't yet been set.
0 commit comments