mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
chainntnfs/test: parallelize iface tests by backend
This commit is contained in:
parent
0d57ff2432
commit
ea8d02eb68
15
chainntnfs/test/bitcoind/bitcoind_test.go
Normal file
15
chainntnfs/test/bitcoind/bitcoind_test.go
Normal file
@ -0,0 +1,15 @@
|
||||
// +build dev
|
||||
|
||||
package bitcoind_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
chainntnfstest "github.com/lightningnetwork/lnd/chainntnfs/test"
|
||||
)
|
||||
|
||||
// TestInterfaces executes the generic notifier test suite against a bitcoind
|
||||
// powered chain notifier.
|
||||
func TestInterfaces(t *testing.T) {
|
||||
chainntnfstest.TestInterfaces(t, "bitcoind")
|
||||
}
|
15
chainntnfs/test/btcd/btcd_test.go
Normal file
15
chainntnfs/test/btcd/btcd_test.go
Normal file
@ -0,0 +1,15 @@
|
||||
// +build dev
|
||||
|
||||
package btcd_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
chainntnfstest "github.com/lightningnetwork/lnd/chainntnfs/test"
|
||||
)
|
||||
|
||||
// TestInterfaces executes the generic notifier test suite against a btcd
|
||||
// powered chain notifier.
|
||||
func TestInterfaces(t *testing.T) {
|
||||
chainntnfstest.TestInterfaces(t, "btcd")
|
||||
}
|
15
chainntnfs/test/neutrino/neutrino_test.go
Normal file
15
chainntnfs/test/neutrino/neutrino_test.go
Normal file
@ -0,0 +1,15 @@
|
||||
// +build dev
|
||||
|
||||
package neutrino_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
chainntnfstest "github.com/lightningnetwork/lnd/chainntnfs/test"
|
||||
)
|
||||
|
||||
// TestInterfaces executes the generic notifier test suite against a neutrino
|
||||
// powered chain notifier.
|
||||
func TestInterfaces(t *testing.T) {
|
||||
chainntnfstest.TestInterfaces(t, "neutrino")
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// +build dev
|
||||
|
||||
package chainntnfs_test
|
||||
package chainntnfstest
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@ -1893,7 +1893,7 @@ var blockCatchupTests = []blockCatchupTestCase{
|
||||
// import should trigger an init() method within the package which registers
|
||||
// the interface. Second, an additional case in the switch within the main loop
|
||||
// below needs to be added which properly initializes the interface.
|
||||
func TestInterfaces(t *testing.T) {
|
||||
func TestInterfaces(t *testing.T, targetBackEnd string) {
|
||||
// Initialize the harness around a btcd node which will serve as our
|
||||
// dedicated miner to generate blocks, cause re-orgs, etc. We'll set up
|
||||
// this node with a chain length of 125, so we have plenty of BTC to
|
||||
@ -1908,6 +1908,11 @@ func TestInterfaces(t *testing.T) {
|
||||
2*len(txNtfnTests)+len(blockNtfnTests)+len(blockCatchupTests))
|
||||
|
||||
for _, notifierDriver := range chainntnfs.RegisteredNotifiers() {
|
||||
notifierType := notifierDriver.NotifierType
|
||||
if notifierType != targetBackEnd {
|
||||
continue
|
||||
}
|
||||
|
||||
// Initialize a height hint cache for each notifier.
|
||||
tempDir, err := ioutil.TempDir("", "channeldb")
|
||||
if err != nil {
|
||||
@ -1926,9 +1931,8 @@ func TestInterfaces(t *testing.T) {
|
||||
}
|
||||
|
||||
var (
|
||||
cleanUp func()
|
||||
newNotifier func() (chainntnfs.TestChainNotifier, error)
|
||||
notifierType = notifierDriver.NotifierType
|
||||
cleanUp func()
|
||||
newNotifier func() (chainntnfs.TestChainNotifier, error)
|
||||
)
|
||||
|
||||
switch notifierType {
|
Loading…
Reference in New Issue
Block a user