test: update integration tests to use DescribeGraph

This commit is contained in:
Olaoluwa Osuntokun 2016-12-26 23:52:56 -06:00
parent d70f03435b
commit 2651541139
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -706,44 +706,44 @@ func testMultiHopPayments(net *networkHarness, t *harnessTest) {
// with the two channels above recognized as the only links within the // with the two channels above recognized as the only links within the
// network. // network.
time.Sleep(time.Second) time.Sleep(time.Second)
req := &lnrpc.ShowRoutingTableRequest{} req := &lnrpc.ChannelGraphRequest{}
routingResp, err := carol.ShowRoutingTable(ctxb, req) chanGraph, err := carol.DescribeGraph(ctxb, req)
if err != nil { if err != nil {
t.Fatalf("unable to query for carol's routing table: %v", err) t.Fatalf("unable to query for carol's routing table: %v", err)
} }
if len(routingResp.Channels) != 2 { if len(chanGraph.Edges) != 2 {
t.Fatalf("only two channels should be seen as active in the "+ t.Fatalf("only two channels should be seen as active in the "+
"network, instead %v are", len(routingResp.Channels)) "network, instead %v are", len(chanGraph.Edges))
} }
for _, link := range routingResp.Channels { for _, link := range chanGraph.Edges {
switch { switch {
case link.Outpoint == aliceFundPoint.String(): case link.ChanPoint == aliceFundPoint.String():
switch { switch {
case link.Id1 == net.Alice.PubKeyStr && case link.Node1Pub == net.Alice.PubKeyStr &&
link.Id2 == net.Bob.PubKeyStr: link.Node2Pub == net.Bob.PubKeyStr:
continue continue
case link.Id1 == net.Bob.PubKeyStr && case link.Node1Pub == net.Bob.PubKeyStr &&
link.Id2 == net.Alice.PubKeyStr: link.Node2Pub == net.Alice.PubKeyStr:
continue continue
default: default:
t.Fatalf("unkown link within routing "+ t.Fatalf("unknown link within routing "+
"table: %v", spew.Sdump(link)) "table: %v", spew.Sdump(link))
} }
case link.Outpoint == carolFundPoint.String(): case link.ChanPoint == carolFundPoint.String():
switch { switch {
case link.Id1 == net.Alice.PubKeyStr && case link.Node1Pub == net.Alice.PubKeyStr &&
link.Id2 == carol.PubKeyStr: link.Node2Pub == carol.PubKeyStr:
continue continue
case link.Id1 == carol.PubKeyStr && case link.Node1Pub == carol.PubKeyStr &&
link.Id2 == net.Alice.PubKeyStr: link.Node2Pub == net.Alice.PubKeyStr:
continue continue
default: default:
t.Fatalf("unkown link within routing "+ t.Fatalf("unknown link within routing "+
"table: %v", spew.Sdump(link)) "table: %v", spew.Sdump(link))
} }
default: default:
t.Fatalf("unkown channel %v found in routing table, "+ t.Fatalf("unknown channel %v found in routing table, "+
"only %v and %v should exist", link.Outpoint, "only %v and %v should exist", spew.Sdump(link),
aliceFundPoint, carolFundPoint) aliceFundPoint, carolFundPoint)
} }
} }
@ -1310,7 +1310,7 @@ poll:
t.Fatalf("justice tx wasn't mined") t.Fatalf("justice tx wasn't mined")
} }
// Finally, obtain Alie's channel state, she shouldn't report any // Finally, obtain Alice's channel state, she shouldn't report any
// channel as she just successfully brought Bob to justice by sweeping // channel as she just successfully brought Bob to justice by sweeping
// all the channel funds. // all the channel funds.
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)