faraday/itest/setup_test.go
Joost Jager 3aad15ca27
itest: add itest setup with two lnd nodes and a single faraday instance
This commit adds an itest setup which can be used to test faraday's rpc.
The setup is largely copied from our existing loop server itests.
2020-08-12 11:42:09 +02:00

41 lines
875 B
Go

package itest
import (
"context"
"testing"
"github.com/stretchr/testify/require"
)
// TestSetup sets up a shared test environment.
func TestSetup(t *testing.T) {
log.Infof("Running golang test setup")
c := newTestContext(t)
// Supply client and server with coins.
aliceAddr, err := c.aliceClient.WalletKit.NextAddr(
context.Background(),
)
require.NoError(c.t, err)
_, err = c.bitcoindClient.GenerateToAddress(1, aliceAddr, nil)
require.NoError(c.t, err)
bobAddr, err := c.bobClient.WalletKit.NextAddr(
context.Background(),
)
require.NoError(c.t, err)
_, err = c.bitcoindClient.GenerateToAddress(1, bobAddr, nil)
require.NoError(c.t, err)
// Mine 100 blocks to allow spending of the coinbase txes.
c.mineBlocks(100)
c.waitBalance(func(b balances) bool {
return b.aliceWallet > 0 && b.bobWallet > 0
})
log.Infof("Test setup complete")
}