routing/test: allow arbitrary graph source nodes

This commit is contained in:
Joost Jager committed 2019-07-11 10:37:22 +02:00
1 parent 93aad89f4c
commit 569f821142
2 files changed
+40 -17

No files matched your search

+16 -6
View File
@@ -342,7 +342,7 @@ func TestChannelUpdateValidation(t *testing.T) {
}, 2),
}
testGraph, err := createTestGraphFromChannels(testChannels)
testGraph, err := createTestGraphFromChannels(testChannels, "a")
defer testGraph.cleanUp()
if err != nil {
t.Fatalf("unable to create graph: %v", err)
@@ -1039,7 +1039,9 @@ func TestIgnoreChannelEdgePolicyForUnknownChannel(t *testing.T) {
// Setup an initially empty network.
testChannels := []*testChannel{}
testGraph, err := createTestGraphFromChannels(testChannels)
testGraph, err := createTestGraphFromChannels(
testChannels, "roasbeef",
)
if err != nil {
t.Fatalf("unable to create graph: %v", err)
}
@@ -2027,7 +2029,7 @@ func TestPruneChannelGraphStaleEdges(t *testing.T) {
// We'll create our test graph and router backed with these test
// channels we've created.
testGraph, err := createTestGraphFromChannels(testChannels)
testGraph, err := createTestGraphFromChannels(testChannels, "a")
if err != nil {
t.Fatalf("unable to create test graph: %v", err)
}
@@ -2064,6 +2066,14 @@ func TestPruneChannelGraphDoubleDisabled(t *testing.T) {
// according to that heuristic.
timestamp := time.Now()
testChannels := []*testChannel{
// Channel from self shouldn't be pruned.
symmetricTestChannel(
"self", "a", 100000, &testChannelPolicy{
LastUpdate: timestamp,
Disabled: true,
}, 99,
),
// No edges.
{
Node1: &testChannelEnd{Alias: "a"},
@@ -2135,7 +2145,7 @@ func TestPruneChannelGraphDoubleDisabled(t *testing.T) {
// We'll create our test graph and router backed with these test
// channels we've created.
testGraph, err := createTestGraphFromChannels(testChannels)
testGraph, err := createTestGraphFromChannels(testChannels, "self")
if err != nil {
t.Fatalf("unable to create test graph: %v", err)
}
@@ -2543,7 +2553,7 @@ func TestRouterPaymentStateMachine(t *testing.T) {
}, 2),
}
testGraph, err := createTestGraphFromChannels(testChannels)
testGraph, err := createTestGraphFromChannels(testChannels, "a")
if err != nil {
t.Fatalf("unable to create graph: %v", err)
}
@@ -3164,7 +3174,7 @@ func TestSendToRouteStructuredError(t *testing.T) {
}, 2),
}
testGraph, err := createTestGraphFromChannels(testChannels)
testGraph, err := createTestGraphFromChannels(testChannels, "a")
if err != nil {
t.Fatalf("unable to create graph: %v", err)
}