From 3557274142c9c0da7f84d02286ea02cd6d4db435 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 4 Aug 2017 18:34:10 -0700 Subject: [PATCH] test: in testGraphTopologyNotifications only expect 3 notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates the integration tests to reflect the reality after removing code that would always attempt to increment the current update timestamp by one for each channel announcement. Without connecting directly to carol, it isn’t guaranteed that Alice will receive that announcement as Bob would have already processed one for Carol when their channel was created. --- lnd_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lnd_test.go b/lnd_test.go index 71bc2ca6..5153d9e6 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -2222,7 +2222,7 @@ func testGraphTopologyNotifications(net *networkHarness, t *harnessTest) { // We'll launch a goroutine that'll be responsible for proxying all // notifications recv'd from the client into the channel below. quit := make(chan struct{}) - graphUpdates := make(chan *lnrpc.GraphTopologyUpdate, 3) + graphUpdates := make(chan *lnrpc.GraphTopologyUpdate, 4) go func() { for { select { @@ -2242,7 +2242,11 @@ func testGraphTopologyNotifications(net *networkHarness, t *harnessTest) { t.Fatalf("unable to recv graph update: %v", err) } - graphUpdates <- graphUpdate + select { + case graphUpdates <- graphUpdate: + case <-quit: + return + } } } }() @@ -2256,6 +2260,7 @@ func testGraphTopologyNotifications(net *networkHarness, t *harnessTest) { // Ensure that a new update for both created edges is properly // dispatched to our registered client. case graphUpdate := <-graphUpdates: + if len(graphUpdate.ChannelUpdates) > 0 { chanUpdate := graphUpdate.ChannelUpdates[0] if chanUpdate.Capacity != int64(chanAmt) { @@ -2368,7 +2373,7 @@ func testGraphTopologyNotifications(net *networkHarness, t *harnessTest) { // We should receive an update advertising the newly connected node, // Bob's new node announcement, and the channel between Bob and Carol. - for i := 0; i < 4; i++ { + for i := 0; i < 3; i++ { select { case graphUpdate := <-graphUpdates: