test: in testGraphTopologyNotifications only expect 3 notifications

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.
This commit is contained in:
Olaoluwa Osuntokun 2017-08-04 18:34:10 -07:00
parent 43b736225b
commit 3557274142
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

View File

@ -2222,7 +2222,7 @@ func testGraphTopologyNotifications(net *networkHarness, t *harnessTest) {
// We'll launch a goroutine that'll be responsible for proxying all // We'll launch a goroutine that'll be responsible for proxying all
// notifications recv'd from the client into the channel below. // notifications recv'd from the client into the channel below.
quit := make(chan struct{}) quit := make(chan struct{})
graphUpdates := make(chan *lnrpc.GraphTopologyUpdate, 3) graphUpdates := make(chan *lnrpc.GraphTopologyUpdate, 4)
go func() { go func() {
for { for {
select { select {
@ -2242,7 +2242,11 @@ func testGraphTopologyNotifications(net *networkHarness, t *harnessTest) {
t.Fatalf("unable to recv graph update: %v", err) 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 // Ensure that a new update for both created edges is properly
// dispatched to our registered client. // dispatched to our registered client.
case graphUpdate := <-graphUpdates: case graphUpdate := <-graphUpdates:
if len(graphUpdate.ChannelUpdates) > 0 { if len(graphUpdate.ChannelUpdates) > 0 {
chanUpdate := graphUpdate.ChannelUpdates[0] chanUpdate := graphUpdate.ChannelUpdates[0]
if chanUpdate.Capacity != int64(chanAmt) { 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, // We should receive an update advertising the newly connected node,
// Bob's new node announcement, and the channel between Bob and Carol. // 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 { select {
case graphUpdate := <-graphUpdates: case graphUpdate := <-graphUpdates: