@@ -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
@@ -417,16 +425,15 @@ func TestPartialNode(t *testing.T) {
417425 require .ErrorIs (t , err , ErrGraphNodeNotFound )
418426}
419427
420- // TestAliasLookup tests the alias lookup functionality of the graph store.
421- func TestAliasLookup (t * testing.T ) {
422- t .Parallel ()
428+ // testAliasLookup tests the alias lookup functionality of the graph store.
429+ func testAliasLookup (t * testing.T , v lnwire.GossipVersion ) {
423430 ctx := t .Context ()
424431
425- graph := MakeTestGraph (t )
432+ graph := NewVersionedReader ( MakeTestGraph (t ), v )
426433
427434 // We'd like to test the alias index within the database, so first
428435 // create a new test node.
429- testNode := createTestVertex (t , lnwire . GossipVersion1 )
436+ testNode := createTestVertex (t , v )
430437
431438 // Add the node to the graph's database, this should also insert an
432439 // entry into the alias index for this node.
@@ -441,23 +448,23 @@ func TestAliasLookup(t *testing.T) {
441448 require .Equal (t , testNode .Alias .UnwrapOr ("" ), dbAlias )
442449
443450 // Ensure that looking up a non-existent alias results in an error.
444- node := createTestVertex (t , lnwire . GossipVersion1 )
451+ node := createTestVertex (t , v )
445452 nodePub , err = node .PubKey ()
446453 require .NoError (t , err , "unable to generate pubkey" )
447454 _ , err = graph .LookupAlias (ctx , nodePub )
448455 require .ErrorIs (t , err , ErrNodeAliasNotFound )
449456}
450457
451- // TestSourceNode tests the source node functionality of the graph store.
452- func TestSourceNode (t * testing.T ) {
458+ // testSourceNode tests the source node functionality of the graph store.
459+ func testSourceNode (t * testing.T , v lnwire. GossipVersion ) {
453460 t .Parallel ()
454461 ctx := t .Context ()
455462
456- graph := MakeTestGraph (t )
463+ graph := NewVersionedReader ( MakeTestGraph (t ), v )
457464
458465 // We'd like to test the setting/getting of the source node, so we
459466 // first create a fake node to use within the test.
460- testNode := createTestVertex (t , lnwire . GossipVersion1 )
467+ testNode := createTestVertex (t , v )
461468
462469 // Attempt to fetch the source node, this should return an error as the
463470 // source node hasn't yet been set.
0 commit comments