Skip to content

Commit 3793cf0

Browse files
committed
itest: fix itest after lnd update
1 parent 163954e commit 3793cf0

25 files changed

+384
-538
lines changed

itest/addrs_test.go

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ func testAddresses(t *harnessTest) {
4444

4545
// We'll make a second node now that'll be the receiver of all the
4646
// assets made above.
47-
secondTapd := setupTapdHarness(
48-
t.t, t, t.lndHarness.Bob, t.universeServer,
49-
)
47+
bobLnd := t.lndHarness.NewNodeWithCoins("Bob", nil)
48+
secondTapd := setupTapdHarness(t.t, t, bobLnd, t.universeServer)
5049
defer func() {
5150
require.NoError(t.t, secondTapd.stop(!*noDelete))
5251
}()
@@ -183,7 +182,7 @@ func testAddresses(t *harnessTest) {
183182
Amount: 22,
184183
}
185184
manualAsset, mintProofBlob, mintOP := ManualMintSimpleAsset(
186-
t, t.lndHarness.Alice, t.tapd, commitment.TapCommitmentV0, &req,
185+
t, t.tapd.cfg.LndNode, t.tapd, commitment.TapCommitmentV0, &req,
187186
)
188187

189188
numAssets := 2
@@ -267,9 +266,8 @@ func testMultiAddress(t *harnessTest) {
267266
// We'll make a second node now that'll be the receiver of all the
268267
// assets made above.
269268
alice := t.tapd
270-
bob := setupTapdHarness(
271-
t.t, t, t.lndHarness.Bob, t.universeServer,
272-
)
269+
bobLnd := t.lndHarness.NewNodeWithCoins("Bob", nil)
270+
bob := setupTapdHarness(t.t, t, bobLnd, t.universeServer)
273271
defer func() {
274272
require.NoError(t.t, bob.stop(!*noDelete))
275273
}()
@@ -312,8 +310,9 @@ func testMultiAddress(t *harnessTest) {
312310
func testAddressAssetSyncer(t *harnessTest) {
313311
// We'll kick off the test by making a new node, without hooking it up
314312
// to any existing Universe server.
313+
bobLnd := t.lndHarness.NewNodeWithCoins("Bob", nil)
315314
bob := setupTapdHarness(
316-
t.t, t, t.lndHarness.Bob, t.universeServer,
315+
t.t, t, bobLnd, t.universeServer,
317316
func(params *tapdHarnessParams) {
318317
params.noDefaultUniverseSync = true
319318
},
@@ -443,7 +442,7 @@ func testAddressAssetSyncer(t *harnessTest) {
443442
restartBobNoUniSync := func(disableSyncer bool) {
444443
require.NoError(t.t, bob.stop(!*noDelete))
445444
bob = setupTapdHarness(
446-
t.t, t, t.lndHarness.Bob, t.universeServer,
445+
t.t, t, bobLnd, t.universeServer,
447446
func(params *tapdHarnessParams) {
448447
params.noDefaultUniverseSync = true
449448
params.addrAssetSyncerDisable = disableSyncer
@@ -685,9 +684,8 @@ func testUnknownTlvType(t *harnessTest) {
685684
// We'll make a second node now that'll be the receiver of all the
686685
// assets made above.
687686
alice := t.tapd
688-
bob := setupTapdHarness(
689-
t.t, t, t.lndHarness.Bob, t.universeServer,
690-
)
687+
bobLnd := t.lndHarness.NewNodeWithCoins("Bob", nil)
688+
bob := setupTapdHarness(t.t, t, bobLnd, t.universeServer)
691689
defer func() {
692690
require.NoError(t.t, bob.stop(!*noDelete))
693691
}()
@@ -766,9 +764,7 @@ func testUnknownTlvType(t *harnessTest) {
766764
require.NoError(t.t, err)
767765

768766
// We make a new node to import the modified proof.
769-
charlie := setupTapdHarness(
770-
t.t, t, t.lndHarness.Bob, t.universeServer,
771-
)
767+
charlie := setupTapdHarness(t.t, t, bobLnd, t.universeServer)
772768
defer func() {
773769
require.NoError(t.t, charlie.stop(!*noDelete))
774770
}()

itest/assets_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,9 @@ func testMintAssetsWithTapscriptSibling(t *harnessTest) {
507507

508508
// Make a non-tap output from Bob to use in a TX spending Alice's
509509
// genesis UTXO.
510+
bobLnd := t.lndHarness.NewNodeWithCoins("Bob", nil)
510511
burnOutput := MakeOutput(
511-
t, t.lndHarness.Bob, lnrpc.AddressType_TAPROOT_PUBKEY, 500,
512+
t, bobLnd, lnrpc.AddressType_TAPROOT_PUBKEY, 500,
512513
)
513514

514515
// Construct and publish the TX.
@@ -528,16 +529,16 @@ func testMintAssetsWithTapscriptSibling(t *harnessTest) {
528529

529530
var burnTxBuf bytes.Buffer
530531
require.NoError(t.t, burnTx.Serialize(&burnTxBuf))
531-
t.lndHarness.Bob.RPC.PublishTransaction(&walletrpc.Transaction{
532+
bobLnd.RPC.PublishTransaction(&walletrpc.Transaction{
532533
TxHex: burnTxBuf.Bytes(),
533534
})
534535

535536
// Bob should detect the TX, and the resulting confirmed UTXO once
536537
// a new block is mined.
537538
t.lndHarness.Miner().AssertNumTxsInMempool(1)
538-
t.lndHarness.AssertNumUTXOsUnconfirmed(t.lndHarness.Bob, 1)
539+
t.lndHarness.AssertNumUTXOsUnconfirmed(bobLnd, 1)
539540
t.lndHarness.MineBlocksAndAssertNumTxes(1, 1)
540-
t.lndHarness.AssertNumUTXOsWithConf(t.lndHarness.Bob, 1, 1, 1)
541+
t.lndHarness.AssertNumUTXOsWithConf(bobLnd, 1, 1, 1)
541542
}
542543

543544
// testMintBatchAndTransfer tests that we can mint a batch of assets, observe
@@ -557,9 +558,8 @@ func testMintBatchAndTransfer(t *harnessTest) {
557558

558559
// We'll make a second node now that'll be the receiver of all the
559560
// assets made above.
560-
secondTapd := setupTapdHarness(
561-
t.t, t, t.lndHarness.Bob, t.universeServer,
562-
)
561+
bobLnd := t.lndHarness.NewNodeWithCoins("Bob", nil)
562+
secondTapd := setupTapdHarness(t.t, t, bobLnd, t.universeServer)
563563
defer func() {
564564
require.NoError(t.t, secondTapd.stop(!*noDelete))
565565
}()
@@ -676,7 +676,7 @@ func testAssetBalances(t *harnessTest) {
676676
anchorTxid = out.Hash.CloneBytes()
677677
anchorVout = out.Index
678678
aliceTapd = t.tapd
679-
bobLnd = t.lndHarness.Bob
679+
bobLnd = t.lndHarness.NewNodeWithCoins("Bob", nil)
680680
)
681681

682682
// We create a second tapd node that will be used to simulate a second

itest/channels_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ func testChannelRPCs(t *harnessTest) {
4747
require.ErrorContains(t.t, err, "only available when running inside")
4848

4949
// Try the keysend path first, which should go all the way through to
50-
// lnd, where it should fail because we didn't set a timeout.
50+
// lnd, where it should fail because we didn't set a destination public
51+
// key.
5152
stream, err := t.tapd.SendPayment(ctx, &tchrpc.SendPaymentRequest{
5253
AssetAmount: 123,
5354
AssetId: dummyByteArr[:],
@@ -60,12 +61,12 @@ func testChannelRPCs(t *harnessTest) {
6061
require.NoError(t.t, err)
6162

6263
_, err = stream.Recv()
63-
require.ErrorContains(t.t, err, "timeout_seconds")
64+
require.ErrorContains(t.t, err, "invalid vertex length of 0, want 33")
6465

6566
// Now let's also try the invoice path, which should fail because we
6667
// don't have any asset channels with peers that we could ask for a
6768
// quote.
68-
invoiceResp := t.lndHarness.Alice.RPC.AddInvoice(&lnrpc.Invoice{
69+
invoiceResp := t.tapd.cfg.LndNode.RPC.AddInvoice(&lnrpc.Invoice{
6970
AmtPaidSat: 1234,
7071
})
7172
stream, err = t.tapd.SendPayment(ctx, &tchrpc.SendPaymentRequest{

itest/collectible_split_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ func testCollectibleSend(t *harnessTest) {
5151

5252
// Now that we have the asset created, we'll make a new node that'll
5353
// serve as the node which'll receive the assets.
54-
secondTapd := setupTapdHarness(
55-
t.t, t, t.lndHarness.Bob, t.universeServer,
56-
)
54+
lndBob := t.lndHarness.NewNodeWithCoins("Bob", nil)
55+
secondTapd := setupTapdHarness(t.t, t, lndBob, t.universeServer)
5756
defer func() {
5857
require.NoError(t.t, secondTapd.stop(!*noDelete))
5958
}()
@@ -334,9 +333,8 @@ func testCollectibleGroupSend(t *harnessTest) {
334333
})
335334
require.True(t.t, correctOp)
336335

337-
secondTapd := setupTapdHarness(
338-
t.t, t, t.lndHarness.Bob, t.universeServer,
339-
)
336+
lndBob := t.lndHarness.NewNodeWithCoins("Bob", nil)
337+
secondTapd := setupTapdHarness(t.t, t, lndBob, t.universeServer)
340338
defer func() {
341339
require.NoError(t.t, secondTapd.stop(!*noDelete))
342340
}()

itest/fee_estimation_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func testFeeEstimation(t *harnessTest) {
5656

5757
// Set the initial state of the wallet of the first node. The wallet
5858
// state will reset at the end of this test.
59-
SetNodeUTXOs(t, t.lndHarness.Alice, btcutil.Amount(1), initialUTXOs)
60-
defer ResetNodeWallet(t, t.lndHarness.Alice)
59+
SetNodeUTXOs(t, t.tapd.cfg.LndNode, btcutil.Amount(1), initialUTXOs)
60+
defer ResetNodeWallet(t, t.tapd.cfg.LndNode)
6161

6262
t.lndHarness.SetFeeEstimateWithConf(defaultFeeRate, 6)
6363

@@ -154,7 +154,7 @@ func testFeeEstimation(t *harnessTest) {
154154
)
155155

156156
SetNodeUTXOs(
157-
t, t.lndHarness.Alice, btcutil.Amount(1),
157+
t, t.tapd.cfg.LndNode, btcutil.Amount(1),
158158
[]*UTXORequest{initialUTXOs[3]},
159159
)
160160

itest/full_value_split_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ func testFullValueSend(t *harnessTest) {
3131

3232
// Now that we have the asset created, we'll make a new node that'll
3333
// serve as the node which'll receive the assets.
34-
secondTapd := setupTapdHarness(
35-
t.t, t, t.lndHarness.Bob, t.universeServer,
36-
)
34+
lndBob := t.lndHarness.NewNodeWithCoins("Bob", nil)
35+
secondTapd := setupTapdHarness(t.t, t, lndBob, t.universeServer)
3736
defer func() {
3837
require.NoError(t.t, secondTapd.stop(!*noDelete))
3938
}()

itest/integration_test.go

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ package itest
55
import (
66
"context"
77
"flag"
8-
"fmt"
98
"testing"
10-
"time"
119

1210
"github.com/lightninglabs/taproot-assets/taprpc"
1311
"github.com/lightningnetwork/lnd/lntest"
@@ -41,49 +39,37 @@ func TestTaprootAssetsDaemon(t *testing.T) {
4139
lndHarness := lntest.SetupHarness(
4240
t, "./lnd-itest", "bbolt", true, feeService,
4341
)
44-
defer func() {
45-
// There is a timing issue in here somewhere. If we shut down
46-
// lnd immediately after stopping the tapd server, sometimes
47-
// we get a race in the TX notifier chan closes. The wait seems
48-
// to fix it for now...
49-
time.Sleep(100 * time.Millisecond)
50-
lndHarness.Stop()
51-
}()
52-
53-
lndHarness.SetupStandbyNodes()
54-
55-
// Create a new LND node for use with the universe server.
56-
t.Log("Starting universe server LND node")
57-
uniServerLndHarness := lndHarness.NewNode("uni-server-lnd", nil)
58-
59-
// Wait for the new LND node to be fully synced to the blockchain.
60-
lndHarness.WaitForBlockchainSync(uniServerLndHarness)
42+
t.Cleanup(func() {
43+
lndHarness.CleanShutDown()
44+
})
6145

6246
t.Logf("Running %v integration tests", len(testList))
6347
for _, testCase := range testList {
64-
logLine := fmt.Sprintf("STARTING ============ %v ============\n",
65-
testCase.name)
66-
6748
success := t.Run(testCase.name, func(t1 *testing.T) {
49+
// Create a new LND node for use with the universe
50+
// server.
51+
t.Log("Starting universe server LND node")
52+
uniServerLndHarness := lndHarness.NewNode(
53+
"uni-server-lnd", nil,
54+
)
55+
56+
// We need to shut down any lnd nodes that were created
57+
// for this test case.
58+
t1.Cleanup(func() {
59+
lndHarness.CleanShutDown()
60+
})
61+
62+
// Wait for the new LND node to be fully synced to the
63+
// blockchain.
64+
lndHarness.WaitForBlockchainSync(uniServerLndHarness)
65+
6866
// The universe server and tapd client are both freshly
6967
// created and later discarded for each test run to
7068
// assure no state is taken over between runs.
7169
tapdHarness, uniHarness, proofCourier := setupHarnesses(
7270
t1, ht, lndHarness, uniServerLndHarness,
7371
testCase.proofCourierType,
7472
)
75-
lndHarness.EnsureConnected(
76-
lndHarness.Alice, lndHarness.Bob,
77-
)
78-
lndHarness.EnsureConnected(
79-
lndHarness.Alice, uniServerLndHarness,
80-
)
81-
lndHarness.EnsureConnected(
82-
lndHarness.Bob, uniServerLndHarness,
83-
)
84-
85-
lndHarness.Alice.AddToLogf(logLine)
86-
lndHarness.Bob.AddToLogf(logLine)
8773

8874
ht := ht.newHarnessTest(
8975
t1, lndHarness, uniHarness, tapdHarness,

itest/mint_batch_stress_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ func testMintBatchNStressTest(t *harnessTest, batchSize int,
5757

5858
// If we create a second tapd instance and sync the universe state,
5959
// the synced tree should match the source tree.
60-
bob := setupTapdHarness(
61-
t.t, t, t.lndHarness.Bob, t.universeServer,
62-
)
60+
lndBob := t.lndHarness.NewNodeWithCoins("Bob", nil)
61+
bob := setupTapdHarness(t.t, t, lndBob, t.universeServer)
6362
defer func() {
6463
require.NoError(t.t, bob.stop(!*noDelete))
6564
}()

itest/mint_fund_seal_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func testMintFundSealAssets(t *harnessTest) {
4242
// party in the test. This tapd node is connected to lnd "Bob".
4343
var (
4444
aliceTapd = t.tapd
45-
aliceLnd = t.lndHarness.Alice
46-
bobLnd = t.lndHarness.Bob
45+
aliceLnd = t.tapd.cfg.LndNode
46+
bobLnd = t.lndHarness.NewNodeWithCoins("Bob", nil)
4747
bobTapd = setupTapdHarness(t.t, t, bobLnd, t.universeServer)
4848
)
4949

itest/multi_asset_group_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ func testMintMultiAssetGroups(t *harnessTest) {
9595

9696
// Finally, we send some assets from the multi-asset group to Bob to
9797
// ensure that they can be sent and received correctly.
98-
secondTapd := setupTapdHarness(
99-
t.t, t, t.lndHarness.Bob, t.universeServer,
100-
)
98+
lndBob := t.lndHarness.NewNodeWithCoins("Bob", nil)
99+
secondTapd := setupTapdHarness(t.t, t, lndBob, t.universeServer)
101100
defer func() {
102101
require.NoError(t.t, secondTapd.stop(!*noDelete))
103102
}()
@@ -329,9 +328,8 @@ func testMultiAssetGroupSend(t *harnessTest) {
329328

330329
// We'll make a second node now that'll be the receiver of all the
331330
// assets made above.
332-
secondTapd := setupTapdHarness(
333-
t.t, t, t.lndHarness.Bob, t.universeServer,
334-
)
331+
lndBob := t.lndHarness.NewNodeWithCoins("Bob", nil)
332+
secondTapd := setupTapdHarness(t.t, t, lndBob, t.universeServer)
335333
defer func() {
336334
require.NoError(t.t, secondTapd.stop(!*noDelete))
337335
}()

0 commit comments

Comments
 (0)