routing: use require in router test

This commit refactors some of the tests in router_test.go to use the
require package.
This commit is contained in:
yyforyongyu
2021-04-14 12:58:12 +08:00
parent 8172811e74
commit 54aacacc11
3 changed files with 194 additions and 374 deletions

View File

@@ -352,11 +352,8 @@ func (m *mockChainView) Stop() error {
func TestEdgeUpdateNotification(t *testing.T) {
t.Parallel()
ctx, cleanUp, err := createTestCtxSingleNode(0)
ctx, cleanUp := createTestCtxSingleNode(t, 0)
defer cleanUp()
if err != nil {
t.Fatalf("unable to create router: %v", err)
}
// First we'll create the utxo for the channel to be "closed"
const chanValue = 10000
@@ -546,11 +543,8 @@ func TestNodeUpdateNotification(t *testing.T) {
t.Parallel()
const startingBlockHeight = 101
ctx, cleanUp, err := createTestCtxSingleNode(startingBlockHeight)
ctx, cleanUp := createTestCtxSingleNode(t, startingBlockHeight)
defer cleanUp()
if err != nil {
t.Fatalf("unable to create router: %v", err)
}
// We only accept node announcements from nodes having a known channel,
// so create one now.
@@ -739,11 +733,8 @@ func TestNotificationCancellation(t *testing.T) {
t.Parallel()
const startingBlockHeight = 101
ctx, cleanUp, err := createTestCtxSingleNode(startingBlockHeight)
ctx, cleanUp := createTestCtxSingleNode(t, startingBlockHeight)
defer cleanUp()
if err != nil {
t.Fatalf("unable to create router: %v", err)
}
// Create a new client to receive notifications.
ntfnClient, err := ctx.router.SubscribeTopology()
@@ -831,11 +822,8 @@ func TestChannelCloseNotification(t *testing.T) {
t.Parallel()
const startingBlockHeight = 101
ctx, cleanUp, err := createTestCtxSingleNode(startingBlockHeight)
ctx, cleanUp := createTestCtxSingleNode(t, startingBlockHeight)
defer cleanUp()
if err != nil {
t.Fatalf("unable to create router: %v", err)
}
// First we'll create the utxo for the channel to be "closed"
const chanValue = 10000