@@ -129,6 +129,14 @@ var versionedTests = []versionedTest{
129129 name : "node crud" ,
130130 test : testNodeInsertionAndDeletion ,
131131 },
132+ {
133+ name : "source node" ,
134+ test : testSourceNode ,
135+ },
136+ {
137+ name : "alias lookup" ,
138+ test : testAliasLookup ,
139+ },
132140}
133141
134142// TestVersionedDBs runs various tests against both v1 and v2 versioned
@@ -416,16 +424,15 @@ func TestPartialNode(t *testing.T) {
416424 require .ErrorIs (t , err , ErrGraphNodeNotFound )
417425}
418426
419- // TestAliasLookup tests the alias lookup functionality of the graph store.
420- func TestAliasLookup (t * testing.T ) {
421- t .Parallel ()
427+ // testAliasLookup tests the alias lookup functionality of the graph store.
428+ func testAliasLookup (t * testing.T , v lnwire.GossipVersion ) {
422429 ctx := t .Context ()
423430
424- graph := MakeTestGraph (t )
431+ graph := NewVersionedReader ( MakeTestGraph (t ), v )
425432
426433 // We'd like to test the alias index within the database, so first
427434 // create a new test node.
428- testNode := createTestVertex (t , lnwire . GossipVersion1 )
435+ testNode := createTestVertex (t , v )
429436
430437 // Add the node to the graph's database, this should also insert an
431438 // entry into the alias index for this node.
@@ -440,23 +447,23 @@ func TestAliasLookup(t *testing.T) {
440447 require .Equal (t , testNode .Alias .UnwrapOr ("" ), dbAlias )
441448
442449 // Ensure that looking up a non-existent alias results in an error.
443- node := createTestVertex (t , lnwire . GossipVersion1 )
450+ node := createTestVertex (t , v )
444451 nodePub , err = node .PubKey ()
445452 require .NoError (t , err , "unable to generate pubkey" )
446453 _ , err = graph .LookupAlias (ctx , nodePub )
447454 require .ErrorIs (t , err , ErrNodeAliasNotFound )
448455}
449456
450- // TestSourceNode tests the source node functionality of the graph store.
451- func TestSourceNode (t * testing.T ) {
457+ // testSourceNode tests the source node functionality of the graph store.
458+ func testSourceNode (t * testing.T , v lnwire. GossipVersion ) {
452459 t .Parallel ()
453460 ctx := t .Context ()
454461
455- graph := MakeTestGraph (t )
462+ graph := NewVersionedReader ( MakeTestGraph (t ), v )
456463
457464 // We'd like to test the setting/getting of the source node, so we
458465 // first create a fake node to use within the test.
459- testNode := createTestVertex (t , lnwire . GossipVersion1 )
466+ testNode := createTestVertex (t , v )
460467
461468 // Attempt to fetch the source node, this should return an error as the
462469 // source node hasn't yet been set.
0 commit comments