test: add method to dump logs of a node within the networkHarness

At times when testing one requires access to the logs of a particular
node in order to aide with debugging. Before this commit, one needed to
manually modify the networkHarness code in order to print either the
location of the logs or the logs themselves. With this commit, tests
can now programmatically examine the logs of any node created within
the networkHarness.

It’s worth noting that at times the logs dumped may not be the most up
to date version of the logs files as the logging library employs
intermediate buffering.
This commit is contained in:
Olaoluwa Osuntokun
2016-09-10 13:14:28 -07:00
parent e536e1afb1
commit d2acb4336c
2 changed files with 52 additions and 45 deletions

View File

@ -37,7 +37,7 @@ func testBasicChannelFunding(net *networkHarness, t *testing.T) {
// First establish a channel ween with a capacity of 0.5 BTC between
// Alice and Bob.
chanAmt := btcutil.Amount(btcutil.SatoshiPerBitcoin / 2)
chanOpenUpdate, err := net.OpenChannel(ctxb, net.AliceClient, net.BobClient, chanAmt, 1)
chanOpenUpdate, err := net.OpenChannel(ctxb, net.Alice, net.Bob, chanAmt, 1)
if err != nil {
t.Fatalf("unable to open channel: %v", err)
}
@ -69,13 +69,13 @@ func testBasicChannelFunding(net *networkHarness, t *testing.T) {
Hash: *fundingTxID,
Index: fundingChanPoint.OutputIndex,
}
err = net.AssertChannelExists(ctxb, net.AliceClient, &chanPoint)
err = net.AssertChannelExists(ctxb, net.Alice, &chanPoint)
if err != nil {
t.Fatalf("unable to assert channel existence: %v", err)
}
// Initiate a close from Alice's side.
closeUpdates, err := net.CloseChannel(ctxb, net.AliceClient, fundingChanPoint, false)
closeUpdates, err := net.CloseChannel(ctxb, net.Alice, fundingChanPoint, false)
if err != nil {
t.Fatalf("unable to clsoe channel: %v", err)
}