sqldb+graph/db: source nodes table, queries and CRUD

In this commit, we add the `source_nodes` table. It points to entries in
the `nodes` table. This table will store one entry per protocol version
that we are announcing a node_announcement on.

With this commit, we can run the TestSourceNode unit test against our
SQL backends.
This commit is contained in:
Elle Mouton
2025-05-19 12:11:15 +02:00
parent 86d48390ca
commit 0064d33cda
8 changed files with 184 additions and 5 deletions

View File

@@ -355,10 +355,11 @@ func TestAliasLookup(t *testing.T) {
require.ErrorIs(t, err, ErrNodeAliasNotFound)
}
// TestSourceNode tests the source node functionality of the graph store.
func TestSourceNode(t *testing.T) {
t.Parallel()
graph := MakeTestGraph(t)
graph := MakeTestGraphNew(t)
// We'd like to test the setting/getting of the source node, so we
// first create a fake node to use within the test.
@@ -369,11 +370,9 @@ func TestSourceNode(t *testing.T) {
_, err := graph.SourceNode()
require.ErrorIs(t, err, ErrSourceNodeNotSet)
// Set the source the source node, this should insert the node into the
// Set the source node, this should insert the node into the
// database in a special way indicating it's the source node.
if err := graph.SetSourceNode(testNode); err != nil {
t.Fatalf("unable to set source node: %v", err)
}
require.NoError(t, graph.SetSourceNode(testNode))
// Retrieve the source node from the database, it should exactly match
// the one we set above.