test: rename CT to harnessTest, ensure all RPC's get distinct timeouts

This commit slightly modifies the existing CT struct in order to
maintain consistency with code-style. As a result of the name change,
all references have also been renamed from `ct` to `t`.

The Error and Errorf methods have been removed in favor of forcing
everything to be reported via `Fatalf`. Additionally a new method
(ProcessErrors) has been introduced to the networkHarness class in
order to encapsulate the underlying channel.
This commit is contained in:
Olaoluwa Osuntokun committed 2016-10-23 19:27:24 -07:00
1 parent 5d6b8e49a3
commit 517255fdb1
3 files changed
+201 -191

No files matched your search

+13 -6
View File
@@ -20,6 +20,7 @@ import (
"google.golang.org/grpc/grpclog"
"bytes"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/roasbeef/btcd/chaincfg"
@@ -174,9 +175,9 @@ func (l *lightningNode) start(lndError chan error) error {
return err
}
// Launch a new goroutine which that bubbles up any potential fatal
// process errors to the goroutine running the tests.
go func() {
// If lightning node process exited with error status
// then we should transmit stderr output in main process.
if err := l.cmd.Wait(); err != nil {
lndError <- errors.New(errb.String())
}
@@ -249,14 +250,13 @@ func (l *lightningNode) cleanup() error {
// stop attempts to stop the active lnd process.
func (l *lightningNode) stop() error {
// We should skip node stop in case:
// - start of the node wasn't initiated
// - process wasn't spawned
// - process already finished
if l.cmd == nil ||
l.cmd.Process == nil ||
(l.cmd.ProcessState != nil && l.cmd.ProcessState.Exited()) {
processFinished := l.cmd.ProcessState != nil &&
l.cmd.ProcessState.Exited()
if l.cmd == nil || l.cmd.Process == nil || processFinished {
return nil
}
@@ -344,6 +344,13 @@ func (n *networkHarness) InitializeSeedNodes(r *rpctest.Harness, lndArgs []strin
return err
}
// ProcessErrors returns a channel used for reporting any fatal process errors.
// If any of the active nodes within the harness' test network incur a fatal
// error, that error is sent over this channel.
func (n *networkHarness) ProcessErrors() chan error {
return n.lndErrorChan
}
// fakeLogger is a fake grpclog.Logger implementation. This is used to stop
// grpc's logger from printing directly to stdout.
type fakeLogger struct{}