test: use *testing.T directly outside of test execution
This commit is contained in:
parent
a7b7f4f272
commit
d181aad8e2
20
lnd_test.go
20
lnd_test.go
@ -885,7 +885,7 @@ func TestLightningNetworkDaemon(t *testing.T) {
|
|||||||
// 'OnTxAccepted' call back.
|
// 'OnTxAccepted' call back.
|
||||||
lndHarness, err := newNetworkHarness()
|
lndHarness, err := newNetworkHarness()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ht.Fatalf("unable to create lightning network harness: %v", err)
|
t.Fatalf("unable to create lightning network harness: %v", err)
|
||||||
}
|
}
|
||||||
defer lndHarness.TearDownAll()
|
defer lndHarness.TearDownAll()
|
||||||
|
|
||||||
@ -898,14 +898,14 @@ func TestLightningNetworkDaemon(t *testing.T) {
|
|||||||
// drive blockchain related events within the network.
|
// drive blockchain related events within the network.
|
||||||
btcdHarness, err := rpctest.New(harnessNetParams, handlers, nil)
|
btcdHarness, err := rpctest.New(harnessNetParams, handlers, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ht.Fatalf("unable to create mining node: %v", err)
|
t.Fatalf("unable to create mining node: %v", err)
|
||||||
}
|
}
|
||||||
defer btcdHarness.TearDown()
|
defer btcdHarness.TearDown()
|
||||||
if err := btcdHarness.SetUp(true, 50); err != nil {
|
if err := btcdHarness.SetUp(true, 50); err != nil {
|
||||||
ht.Fatalf("unable to set up mining node: %v", err)
|
t.Fatalf("unable to set up mining node: %v", err)
|
||||||
}
|
}
|
||||||
if err := btcdHarness.Node.NotifyNewTransactions(false); err != nil {
|
if err := btcdHarness.Node.NotifyNewTransactions(false); err != nil {
|
||||||
ht.Fatalf("unable to request transaction notifications: %v", err)
|
t.Fatalf("unable to request transaction notifications: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// With the btcd harness created, we can now complete the
|
// With the btcd harness created, we can now complete the
|
||||||
@ -913,13 +913,13 @@ func TestLightningNetworkDaemon(t *testing.T) {
|
|||||||
// example: "--debuglevel=debug"
|
// example: "--debuglevel=debug"
|
||||||
// TODO(roasbeef): create master balanced channel with all the monies?
|
// TODO(roasbeef): create master balanced channel with all the monies?
|
||||||
if err := lndHarness.InitializeSeedNodes(btcdHarness, nil); err != nil {
|
if err := lndHarness.InitializeSeedNodes(btcdHarness, nil); err != nil {
|
||||||
ht.Fatalf("unable to initialize seed nodes: %v", err)
|
t.Fatalf("unable to initialize seed nodes: %v", err)
|
||||||
}
|
}
|
||||||
if err = lndHarness.SetUp(); err != nil {
|
if err = lndHarness.SetUp(); err != nil {
|
||||||
ht.Fatalf("unable to set up test lightning network: %v", err)
|
t.Fatalf("unable to set up test lightning network: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ht.Logf("Running %v integration tests", len(testCases))
|
t.Logf("Running %v integration tests", len(testCases))
|
||||||
for name, test := range testCases {
|
for name, test := range testCases {
|
||||||
errChan := ht.RunTest(lndHarness, test)
|
errChan := ht.RunTest(lndHarness, test)
|
||||||
|
|
||||||
@ -929,15 +929,15 @@ func TestLightningNetworkDaemon(t *testing.T) {
|
|||||||
// without any problems.
|
// without any problems.
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ht.Fatalf("Fail: (%v): exited with error: \n%v",
|
t.Fatalf("Fail: (%v): exited with error: \n%v",
|
||||||
name, err)
|
name, err)
|
||||||
}
|
}
|
||||||
ht.Logf("Passed: (%v)", name)
|
t.Logf("Passed: (%v)", name)
|
||||||
|
|
||||||
// If a read from this channel succeeeds then one of the
|
// If a read from this channel succeeeds then one of the
|
||||||
// running lnd nodes has exited with a fatal erorr.
|
// running lnd nodes has exited with a fatal erorr.
|
||||||
case err := <-lndHarness.ProcessErrors():
|
case err := <-lndHarness.ProcessErrors():
|
||||||
ht.Fatalf("Fail: (%v): lnd finished with error "+
|
t.Fatalf("Fail: (%v): lnd finished with error "+
|
||||||
"(stderr): \n%v", name, err)
|
"(stderr): \n%v", name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user