multi: run all test instances in parallel
This commit is contained in:
parent
bb9bc9205a
commit
1be4d67ce4
@ -65,6 +65,8 @@ func establishTestConnection() (net.Conn, net.Conn, error) {
|
||||
}
|
||||
|
||||
func TestConnectionCorrectness(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Create a test connection, grabbing either side of the connection
|
||||
// into local variables. If the initial crypto handshake fails, then
|
||||
// we'll get a non-nil error here.
|
||||
@ -114,6 +116,8 @@ func TestConnectionCorrectness(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMaxPayloadLength(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
b := Machine{}
|
||||
b.split()
|
||||
|
||||
@ -152,6 +156,8 @@ func TestMaxPayloadLength(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWriteMessageChunking(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Create a test connection, grabbing either side of the connection
|
||||
// into local variables. If the initial crypto handshake fails, then
|
||||
// we'll get a non-nil error here.
|
||||
|
@ -178,6 +178,8 @@ func createTestChannelState(cdb *DB) (*OpenChannel, error) {
|
||||
}
|
||||
|
||||
func TestOpenChannelPutGetDelete(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cdb, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -407,6 +409,8 @@ func TestOpenChannelPutGetDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChannelStateTransition(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cdb, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -638,6 +642,8 @@ func TestChannelStateTransition(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFetchPendingChannels(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cdb, cleanUp, err := makeTestDB()
|
||||
if err != nil {
|
||||
t.Fatalf("uanble to make test database: %v", err)
|
||||
@ -717,6 +723,8 @@ func TestFetchPendingChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFetchClosedChannels(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cdb, cleanUp, err := makeTestDB()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to make test database: %v", err)
|
||||
|
@ -8,6 +8,8 @@ import (
|
||||
)
|
||||
|
||||
func TestOpenWithCreate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// First, create a temporary directory to be used for the duration of
|
||||
// this test.
|
||||
tempDirName, err := ioutil.TempDir("", "channeldb")
|
||||
|
@ -63,6 +63,8 @@ func createTestVertex(db *DB) (*LightningNode, error) {
|
||||
}
|
||||
|
||||
func TestNodeInsertionAndDeletion(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -124,6 +126,8 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAliasLookup(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -168,6 +172,8 @@ func TestAliasLookup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSourceNode(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -207,6 +213,8 @@ func TestSourceNode(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEdgeInsertionDeletion(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -332,6 +340,8 @@ func assertEdgeInfoEqual(t *testing.T, e1 *ChannelEdgeInfo,
|
||||
}
|
||||
|
||||
func TestEdgeInfoUpdates(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -500,6 +510,8 @@ func randEdgePolicy(chanID uint64, op wire.OutPoint, db *DB) *ChannelEdgePolicy
|
||||
}
|
||||
|
||||
func TestGraphTraversal(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -709,6 +721,8 @@ func assertChanViewEqual(t *testing.T, a []wire.OutPoint, b []*wire.OutPoint) {
|
||||
}
|
||||
|
||||
func TestGraphPruning(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
|
@ -32,6 +32,8 @@ func randInvoice(value btcutil.Amount) (*Invoice, error) {
|
||||
}
|
||||
|
||||
func TestInvoiceWorkflow(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
// and also initialization of meta data in case if don't have any in
|
||||
// database.
|
||||
func TestVersionFetchPut(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -46,6 +48,8 @@ func TestVersionFetchPut(t *testing.T) {
|
||||
|
||||
// TestOrderOfMigrations checks that migrations are applied in proper order.
|
||||
func TestOrderOfMigrations(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
appliedMigration := -1
|
||||
versions := []version{
|
||||
{0, nil},
|
||||
@ -88,6 +92,8 @@ func TestOrderOfMigrations(t *testing.T) {
|
||||
// TestGlobalVersionList checks that there is no mistake in global version list
|
||||
// in terms of version ordering.
|
||||
func TestGlobalVersionList(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if dbVersions == nil {
|
||||
t.Fatal("can't find versions list")
|
||||
}
|
||||
@ -165,6 +171,8 @@ func applyMigration(t *testing.T, beforeMigration, afterMigration func(d *DB),
|
||||
}
|
||||
|
||||
func TestMigrationWithPanic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bucketPrefix := []byte("somebucket")
|
||||
keyPrefix := []byte("someprefix")
|
||||
beforeMigration := []byte("beforemigration")
|
||||
@ -234,6 +242,8 @@ func TestMigrationWithPanic(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMigrationWithFatal(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bucketPrefix := []byte("somebucket")
|
||||
keyPrefix := []byte("someprefix")
|
||||
beforeMigration := []byte("beforemigration")
|
||||
@ -302,6 +312,8 @@ func TestMigrationWithFatal(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMigrationWithoutErrors(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bucketPrefix := []byte("somebucket")
|
||||
keyPrefix := []byte("someprefix")
|
||||
beforeMigration := []byte("beforemigration")
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
)
|
||||
|
||||
func TestLinkNodeEncodeDecode(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cdb, cleanUp, err := makeTestDB()
|
||||
if err != nil {
|
||||
t.Fatalf("uanble to make test database: %v", err)
|
||||
|
@ -96,6 +96,8 @@ func makeRandomFakePayment() (*OutgoingPayment, error) {
|
||||
}
|
||||
|
||||
func TestOutgoingPaymentSerialization(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fakePayment := makeFakePayment()
|
||||
|
||||
var b bytes.Buffer
|
||||
@ -118,6 +120,8 @@ func TestOutgoingPaymentSerialization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOutgoingPaymentWorkflow(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanUp, err := makeTestDB()
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
// TestWaitingProofStore tests add/get/remove functions of the waiting proof
|
||||
// storage.
|
||||
func TestWaitingProofStore(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db, cleanup, err := makeTestDB()
|
||||
if err != nil {
|
||||
|
||||
|
@ -458,6 +458,8 @@ func createTestCtx(startHeight uint32) (*testCtx, func(), error) {
|
||||
// TestProcessAnnouncement checks that mature announcements are propagated to
|
||||
// the router subsystem.
|
||||
func TestProcessAnnouncement(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cleanup, err := createTestCtx(0)
|
||||
if err != nil {
|
||||
t.Fatalf("can't create context: %v", err)
|
||||
@ -539,6 +541,8 @@ func TestProcessAnnouncement(t *testing.T) {
|
||||
// not propagated to the router subsystem until block with according
|
||||
// block height received.
|
||||
func TestPrematureAnnouncement(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cleanup, err := createTestCtx(0)
|
||||
if err != nil {
|
||||
t.Fatalf("can't create context: %v", err)
|
||||
@ -617,6 +621,8 @@ func TestPrematureAnnouncement(t *testing.T) {
|
||||
// TestSignatureAnnouncementLocalFirst ensures that the AuthenticatedGossiper properly
|
||||
// processes partial and fully announcement signatures message.
|
||||
func TestSignatureAnnouncementLocalFirst(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cleanup, err := createTestCtx(uint32(proofMatureDelta))
|
||||
if err != nil {
|
||||
t.Fatalf("can't create context: %v", err)
|
||||
@ -721,6 +727,8 @@ func TestSignatureAnnouncementLocalFirst(t *testing.T) {
|
||||
// TestOrphanSignatureAnnouncement ensures that the gossiper properly
|
||||
// processes announcement with unknown channel ids.
|
||||
func TestOrphanSignatureAnnouncement(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cleanup, err := createTestCtx(uint32(proofMatureDelta))
|
||||
if err != nil {
|
||||
t.Fatalf("can't create context: %v", err)
|
||||
|
@ -69,6 +69,8 @@ func createLogFunc(name string, channelID lnwire.ChannelID) messageInterceptor {
|
||||
// TestChannelLinkSingleHopPayment in this test we checks the interaction
|
||||
// between Alice and Bob within scope of one channel.
|
||||
func TestChannelLinkSingleHopPayment(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -132,6 +134,8 @@ func TestChannelLinkSingleHopPayment(t *testing.T) {
|
||||
// link to cope with bigger number of payment updates that commitment
|
||||
// transaction may consist.
|
||||
func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -213,6 +217,8 @@ func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
|
||||
// (Carol -> Bob -> Alice) and checking that HTLC was settled properly and
|
||||
// balances were changed in two channels.
|
||||
func TestChannelLinkMultiHopPayment(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -306,6 +312,8 @@ func TestChannelLinkMultiHopPayment(t *testing.T) {
|
||||
// doesn't match the expected payment value, then the HTLC will be rejected
|
||||
// with the appropriate error.
|
||||
func TestExitNodeTimelockPayloadMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -342,6 +350,8 @@ func TestExitNodeTimelockPayloadMismatch(t *testing.T) {
|
||||
// HTLC doesn't match the expected payment value, then the HTLC will be
|
||||
// rejected.
|
||||
func TestExitNodeAmountPayloadMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -376,6 +386,8 @@ func TestExitNodeAmountPayloadMismatch(t *testing.T) {
|
||||
// node in a multi-hop payment, and receives an HTLC which violates its
|
||||
// specified multi-hop policy, then the HTLC is rejected.
|
||||
func TestLinkForwardTimelockPolicyMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -416,6 +428,8 @@ func TestLinkForwardTimelockPolicyMismatch(t *testing.T) {
|
||||
// intermediate node in a multi-hop payment and receives an HTLC that violates
|
||||
// its current fee policy, then the HTLC is rejected with the proper error.
|
||||
func TestLinkForwardFeePolicyMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -457,6 +471,8 @@ func TestLinkForwardFeePolicyMismatch(t *testing.T) {
|
||||
// node and receives an HTLC which is _below_ its min HTLC policy, then the
|
||||
// HTLC will be rejected.
|
||||
func TestLinkForwardMinHTLCPolicyMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -499,6 +515,8 @@ func TestLinkForwardMinHTLCPolicyMismatch(t *testing.T) {
|
||||
// specified policy, assert that it succeeds, update the policy (to invalidate
|
||||
// the prior HTLC), and then ensure that the HTLC is rejected.
|
||||
func TestUpdateForwardingPolicy(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -569,6 +587,8 @@ func TestUpdateForwardingPolicy(t *testing.T) {
|
||||
// bob<->alice channel has insufficient BTC capacity/bandwidth. In this test we
|
||||
// send the payment from Carol to Alice over Bob peer. (Carol -> Bob -> Alice)
|
||||
func TestChannelLinkMultiHopInsufficientPayment(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -636,6 +656,8 @@ func TestChannelLinkMultiHopInsufficientPayment(t *testing.T) {
|
||||
// TestChannelLinkMultiHopUnknownPaymentHash checks that we receive remote error
|
||||
// from Alice if she received not suitable payment hash for htlc.
|
||||
func TestChannelLinkMultiHopUnknownPaymentHash(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -716,6 +738,8 @@ func TestChannelLinkMultiHopUnknownPaymentHash(t *testing.T) {
|
||||
// has no idea about next hop (hop might goes down and routing info not updated
|
||||
// yet).
|
||||
func TestChannelLinkMultiHopUnknownNextHop(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -778,6 +802,8 @@ func TestChannelLinkMultiHopUnknownNextHop(t *testing.T) {
|
||||
// TestChannelLinkMultiHopDecodeError checks that we send HTLC cancel if
|
||||
// decoding of onion blob failed.
|
||||
func TestChannelLinkMultiHopDecodeError(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
@ -844,6 +870,8 @@ func TestChannelLinkMultiHopDecodeError(t *testing.T) {
|
||||
// flying around between Alice and Bob are correct when Bob sends payments to
|
||||
// Alice.
|
||||
func TestChannelLinkSingleHopMessageOrdering(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
|
@ -355,6 +355,8 @@ func calcStaticFee(numHTLCs int) btcutil.Amount {
|
||||
// * DSL language perhaps?
|
||||
// * constructed via input/output files
|
||||
func TestSimpleAddSettleWorkflow(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Create a test channel which will be used for the duration of this
|
||||
// unittest. The channel will be funded evenly with Alice having 5 BTC,
|
||||
// and Bob having 5 BTC.
|
||||
@ -604,6 +606,8 @@ func TestSimpleAddSettleWorkflow(t *testing.T) {
|
||||
// TestCheckCommitTxSize checks that estimation size of commitment
|
||||
// transaction with some degree of error corresponds to the actual size.
|
||||
func TestCheckCommitTxSize(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
checkSize := func(channel *LightningChannel, count int) {
|
||||
// Due to variable size of the signatures (70-73) in
|
||||
// witness script actual size of commitment transaction might
|
||||
@ -695,6 +699,8 @@ func TestCheckCommitTxSize(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCooperativeChannelClosure(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Create a test channel which will be used for the duration of this
|
||||
// unittest. The channel will be funded evenly with Alice having 5 BTC,
|
||||
// and Bob having 5 BTC.
|
||||
@ -743,8 +749,9 @@ func TestCooperativeChannelClosure(t *testing.T) {
|
||||
// TestForceClose checks that the resulting ForceCloseSummary is correct when
|
||||
// a peer is ForceClosing the channel. Will check outputs both above and below
|
||||
// the dust limit.
|
||||
// TODO(cjamthagen): Check HTLCs when implemented.
|
||||
func TestForceClose(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
createHTLC := func(data, amount btcutil.Amount) (*lnwire.UpdateAddHTLC,
|
||||
[32]byte) {
|
||||
preimage := bytes.Repeat([]byte{byte(data)}, 32)
|
||||
@ -929,6 +936,8 @@ func TestForceClose(t *testing.T) {
|
||||
// commitment transaction as output, but sender balance is decreased (thereby all
|
||||
// unsettled dust HTLCs will go to miners fee).
|
||||
func TestCheckDustLimit(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
createHTLC := func(data, amount btcutil.Amount) (*lnwire.UpdateAddHTLC,
|
||||
[32]byte) {
|
||||
preimage := bytes.Repeat([]byte{byte(data)}, 32)
|
||||
@ -1075,6 +1084,8 @@ func TestCheckDustLimit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStateUpdatePersistence(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Create a test channel which will be used for the duration of this
|
||||
// unittest. The channel will be funded evenly with Alice having 5 BTC,
|
||||
// and Bob having 5 BTC.
|
||||
@ -1339,6 +1350,8 @@ func TestStateUpdatePersistence(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCancelHTLC(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Create a test channel which will be used for the duration of this
|
||||
// unittest. The channel will be funded evenly with Alice having 5 BTC,
|
||||
// and Bob having 5 BTC.
|
||||
@ -1437,6 +1450,8 @@ func TestCancelHTLC(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCooperativeCloseDustAdherence(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Create a test channel which will be used for the duration of this
|
||||
// unittest. The channel will be funded evenly with Alice having 5 BTC,
|
||||
// and Bob having 5 BTC.
|
||||
|
@ -1271,6 +1271,8 @@ func clearWalletState(w *lnwallet.LightningWallet) error {
|
||||
//
|
||||
// TODO(roasbeef): purge bobNode in favor of dual lnwallet's
|
||||
func TestLightningWallet(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
netParams := &chaincfg.SimNetParams
|
||||
|
||||
// Initialize the harness around a btcd node which will serve as our
|
||||
|
@ -23,6 +23,8 @@ import (
|
||||
// * Bob's spend from his unencumbered output within Alice's commitment
|
||||
// transaction.
|
||||
func TestCommitmentSpendValidation(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// We generate a fake output, and the corresponding txin. This output
|
||||
// doesn't need to exist, as we'll only be validating spending from the
|
||||
// transaction that references this.
|
||||
@ -181,6 +183,8 @@ func TestCommitmentSpendValidation(t *testing.T) {
|
||||
// hash, the homomorphic revocation public and private key derivation work
|
||||
// properly.
|
||||
func TestRevocationKeyDerivation(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
revocationPreimage := testHdSeed[:]
|
||||
|
||||
priv, pub := btcec.PrivKeyFromBytes(btcec.S256(), testWalletPrivKey)
|
||||
@ -232,6 +236,8 @@ func makeWitnessTestCase(t *testing.T, f func() (wire.TxWitness, error)) func()
|
||||
// * invalid sequence for CSV
|
||||
// * valid lock-time+sequence, valid sig
|
||||
func TestHTLCSenderSpendValidation(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// TODO(roasbeef): eliminate duplication with other HTLC tests.
|
||||
|
||||
// We generate a fake output, and the coresponding txin. This output
|
||||
@ -406,6 +412,8 @@ func TestHTLCSenderSpendValidation(t *testing.T) {
|
||||
// * refund w/ invalid lock time
|
||||
// * refund w/ valid lock time
|
||||
func TestHTLCReceiverSpendValidation(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// We generate a fake output, and the coresponding txin. This output
|
||||
// doesn't need to exist, as we'll only be validating spending from the
|
||||
// transaction that references this.
|
||||
@ -601,6 +609,7 @@ var stateHintTests = []struct {
|
||||
}
|
||||
|
||||
func TestCommitTxStateHint(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var obsfucator [StateHintSize]byte
|
||||
copy(obsfucator[:], testHdSeed[:StateHintSize])
|
||||
|
@ -5,6 +5,8 @@ import "testing"
|
||||
// TestChannelIDOutPointConversion ensures that the IsChanPoint always
|
||||
// recognizes its seed OutPoint for all possible values of an output index.
|
||||
func TestChannelIDOutPointConversion(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testChanPoint := *outpoint1
|
||||
|
||||
// For a given OutPoint, we'll run through all the possible output
|
||||
@ -30,6 +32,8 @@ func TestChannelIDOutPointConversion(t *testing.T) {
|
||||
// root outpoint (the outpoint that generated the ChannelID) is included in the
|
||||
// returned set of outpoints.
|
||||
func TestGenPossibleOutPoints(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// We'll first convert out test outpoint into a ChannelID.
|
||||
testChanPoint := *outpoint1
|
||||
chanID := NewChanIDFromOutPoint(&testChanPoint)
|
||||
|
@ -11,6 +11,8 @@ import (
|
||||
// TestFeaturesRemoteRequireError checks that we throw an error if remote peer
|
||||
// has required feature which we don't support.
|
||||
func TestFeaturesRemoteRequireError(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const (
|
||||
first = "first"
|
||||
second = "second"
|
||||
@ -33,6 +35,8 @@ func TestFeaturesRemoteRequireError(t *testing.T) {
|
||||
// TestFeaturesLocalRequireError checks that we throw an error if local peer has
|
||||
// required feature which remote peer don't support.
|
||||
func TestFeaturesLocalRequireError(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const (
|
||||
first = "first"
|
||||
second = "second"
|
||||
@ -55,6 +59,8 @@ func TestFeaturesLocalRequireError(t *testing.T) {
|
||||
// TestOptionalFeature checks that if remote peer don't have the feature but
|
||||
// on our side this feature is optional than we mark this feature as disabled.
|
||||
func TestOptionalFeature(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const first = "first"
|
||||
|
||||
localFeatures := NewFeatureVector([]Feature{
|
||||
@ -82,6 +88,8 @@ func TestOptionalFeature(t *testing.T) {
|
||||
// TestSetRequireAfterInit checks that we can change the feature flag after
|
||||
// initialization.
|
||||
func TestSetRequireAfterInit(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const first = "first"
|
||||
|
||||
localFeatures := NewFeatureVector([]Feature{
|
||||
@ -100,6 +108,8 @@ func TestSetRequireAfterInit(t *testing.T) {
|
||||
// TestDecodeEncodeFeaturesVector checks that feature vector might be
|
||||
// successfully encoded and decoded.
|
||||
func TestDecodeEncodeFeaturesVector(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const first = "first"
|
||||
|
||||
f := NewFeatureVector([]Feature{
|
||||
@ -124,6 +134,8 @@ func TestDecodeEncodeFeaturesVector(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFeatureFlagString(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if OptionalFlag.String() != "optional" {
|
||||
t.Fatalf("incorrect string, expected optional got %v",
|
||||
OptionalFlag.String())
|
||||
|
@ -63,6 +63,8 @@ func randFeatureVector(r *rand.Rand) *FeatureVector {
|
||||
}
|
||||
|
||||
func TestMaxOutPointIndex(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
op := wire.OutPoint{
|
||||
Index: math.MaxUint32,
|
||||
}
|
||||
@ -74,6 +76,8 @@ func TestMaxOutPointIndex(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEmptyMessageUnknownType(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fakeType := MessageType(math.MaxUint16)
|
||||
if _, err := makeEmptyMessage(fakeType); err == nil {
|
||||
t.Fatalf("should not be able to make an empty message of an " +
|
||||
@ -85,6 +89,8 @@ func TestEmptyMessageUnknownType(t *testing.T) {
|
||||
// of fuzz tests to attempt to break a primary scenario which is implemented as
|
||||
// property based testing scenario.
|
||||
func TestLightningWireProtocol(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// mainScenario is the primary test that will programmatically be
|
||||
// executed for all registered wire messages. The quick-checker within
|
||||
// testing/quick will attempt to find an input to this function, s.t
|
||||
|
@ -9,6 +9,8 @@ import (
|
||||
)
|
||||
|
||||
func TestNetAddressDisplay(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
pubKeyStr := "036a0c5ea35df8a528b98edf6f290b28676d51d0fe202b073fe677612a39c0aa09"
|
||||
pubHex, err := hex.DecodeString(pubKeyStr)
|
||||
if err != nil {
|
||||
|
@ -3,6 +3,8 @@ package lnwire
|
||||
import "testing"
|
||||
|
||||
func TestValidateAlias(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
aliasStr := "012345678901234567890"
|
||||
alias := NewAlias(aliasStr)
|
||||
if err := alias.Validate(); err != nil {
|
||||
|
@ -8,6 +8,8 @@ import (
|
||||
)
|
||||
|
||||
func TestShortChannelIDEncoding(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var testCases = []ShortChannelID{
|
||||
{
|
||||
BlockHeight: (1 << 24) - 1,
|
||||
|
@ -9,6 +9,8 @@ import (
|
||||
)
|
||||
|
||||
func TestSignatureSerializeDeserialize(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Local-scoped closure to serialize and deserialize a Signature and
|
||||
// check for errors as well as check if the results are correct.
|
||||
signatureSerializeDeserialize := func(e btcec.Signature) error {
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
// TestHeapOrdering ensures that the items inserted into the heap are properly
|
||||
// retrieved in minimum order of distance.
|
||||
func TestHeapOrdering(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// First, create a blank heap, we'll use this to push on randomly
|
||||
// generated items.
|
||||
var nodeHeap distanceHeap
|
||||
|
@ -272,6 +272,8 @@ func (m *mockChainView) Stop() error {
|
||||
// TestEdgeUpdateNotification tests that when edges are updated or added,
|
||||
// a proper notification is sent of to all registered clients.
|
||||
func TestEdgeUpdateNotification(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cleanUp, err := createTestCtx(0)
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -427,6 +429,8 @@ func TestEdgeUpdateNotification(t *testing.T) {
|
||||
// either join the network for the first time, or update their authenticated
|
||||
// attributes with new data.
|
||||
func TestNodeUpdateNotification(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cleanUp, err := createTestCtx(1)
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -525,6 +529,8 @@ func TestNodeUpdateNotification(t *testing.T) {
|
||||
// TestNotificationCancellation tests that notifications are properly cancelled
|
||||
// when the client wishes to exit.
|
||||
func TestNotificationCancellation(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const startingBlockHeight = 101
|
||||
ctx, cleanUp, err := createTestCtx(startingBlockHeight)
|
||||
defer cleanUp()
|
||||
@ -573,6 +579,8 @@ func TestNotificationCancellation(t *testing.T) {
|
||||
// TestChannelCloseNotification tests that channel closure notifications are
|
||||
// properly dispatched to all registered clients.
|
||||
func TestChannelCloseNotification(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const startingBlockHeight = 101
|
||||
ctx, cleanUp, err := createTestCtx(startingBlockHeight)
|
||||
defer cleanUp()
|
||||
|
@ -289,6 +289,8 @@ func parseTestGraph(path string) (*channeldb.ChannelGraph, func(), aliasMap, err
|
||||
}
|
||||
|
||||
func TestBasicGraphPathFinding(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
graph, cleanUp, aliases, err := parseTestGraph(basicGraphFilePath)
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -439,6 +441,8 @@ func TestBasicGraphPathFinding(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestKShortestPathFinding(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
graph, cleanUp, aliases, err := parseTestGraph(basicGraphFilePath)
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -498,6 +502,8 @@ func TestKShortestPathFinding(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewRoutePathTooLong(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Ensure that potential paths which are over the maximum hop-limit are
|
||||
// rejected.
|
||||
graph, cleanUp, aliases, err := parseTestGraph(excessiveHopsGraphFilePath)
|
||||
@ -539,6 +545,8 @@ func TestNewRoutePathTooLong(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPathNotAvailable(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
graph, cleanUp, _, err := parseTestGraph(basicGraphFilePath)
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -574,6 +582,8 @@ func TestPathNotAvailable(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPathInsufficientCapacity(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
graph, cleanUp, aliases, err := parseTestGraph(basicGraphFilePath)
|
||||
defer cleanUp()
|
||||
if err != nil {
|
||||
@ -606,6 +616,8 @@ func TestPathInsufficientCapacity(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPathInsufficientCapacityWithFee(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// TODO(roasbeef): encode live graph to json
|
||||
|
||||
// TODO(roasbeef): need to add a case, or modify the fee ratio for one
|
||||
|
@ -109,6 +109,8 @@ func createTestCtx(startingHeight uint32, testGraph ...string) (*testCtx, func()
|
||||
// within the channel router are properly returned in a sorted order, with the
|
||||
// lowest fee route coming first.
|
||||
func TestFindRoutesFeeSorting(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const startingBlockHeight = 101
|
||||
ctx, cleanUp, err := createTestCtx(startingBlockHeight, basicGraphFilePath)
|
||||
defer cleanUp()
|
||||
@ -147,6 +149,8 @@ func TestFindRoutesFeeSorting(t *testing.T) {
|
||||
// queue is used instead. This process should continue until either a payment
|
||||
// succeeds, or all routes have been exhausted.
|
||||
func TestSendPaymentRouteFailureFallback(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const startingBlockHeight = 101
|
||||
ctx, cleanUp, err := createTestCtx(startingBlockHeight, basicGraphFilePath)
|
||||
defer cleanUp()
|
||||
@ -210,6 +214,8 @@ func TestSendPaymentRouteFailureFallback(t *testing.T) {
|
||||
// TestAddProof checks that we can update the channel proof after channel
|
||||
// info was added to the database.
|
||||
func TestAddProof(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cleanup, err := createTestCtx(0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@ -275,6 +281,8 @@ func TestAddProof(t *testing.T) {
|
||||
// TestAddEdgeUnknownVertexes tests that if an edge is added that contains two
|
||||
// vertex which we don't know of, then the edge is rejected.
|
||||
func TestAddEdgeUnknownVertexes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cleanup, err := createTestCtx(0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -162,6 +162,8 @@ func generateTests(t *testing.T) []deriveTest {
|
||||
// TestDeriveIndex check the correctness of index derive function by testing
|
||||
// the index corner cases.
|
||||
func TestDeriveIndex(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, test := range generateTests(t) {
|
||||
pos, err := test.from.deriveBitTransformations(test.to)
|
||||
if err != nil {
|
||||
@ -218,6 +220,8 @@ var deriveElementTests = []struct {
|
||||
// TestSpecificationDeriveElement is used to check the consistency with
|
||||
// specification hash derivation function.
|
||||
func TestSpecificationDeriveElement(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, test := range deriveElementTests {
|
||||
// Generate seed element.
|
||||
element, err := newElementFromStr(test.seed, rootIndex)
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
// TestShaChainProducerRestore checks the ability of shachain producer to be
|
||||
// properly recreated from binary representation.
|
||||
func TestShaChainProducerRestore(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var err error
|
||||
|
||||
seed := chainhash.DoubleHashH([]byte("shachaintest"))
|
||||
|
@ -403,6 +403,8 @@ var tests = []struct {
|
||||
// TestSpecificationShaChainInsert is used to check the consistency with
|
||||
// specification hash insert function.
|
||||
func TestSpecificationShaChainInsert(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, test := range tests {
|
||||
receiver := NewRevocationStore()
|
||||
|
||||
@ -433,6 +435,8 @@ func TestSpecificationShaChainInsert(t *testing.T) {
|
||||
// TestShaChainStore checks the ability of shachain store to hold the produced
|
||||
// secrets after recovering from bytes data.
|
||||
func TestShaChainStore(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
seed := chainhash.DoubleHashH([]byte("shachaintest"))
|
||||
|
||||
sender := NewRevocationProducer(seed)
|
||||
|
@ -194,6 +194,8 @@ var (
|
||||
)
|
||||
|
||||
func TestAddSerializedKidsToList(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var b bytes.Buffer
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
@ -224,6 +226,8 @@ func TestAddSerializedKidsToList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSerializeKidOutput(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
kid := &kidOutputs[0]
|
||||
descriptor := &signDescriptors[0]
|
||||
pk, err := btcec.ParsePubKey(keys[0], btcec.S256())
|
||||
|
@ -28,6 +28,8 @@ var (
|
||||
)
|
||||
|
||||
func TestEncodeDecode(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testPubKey.Curve = nil
|
||||
tests := []struct {
|
||||
version int
|
||||
@ -82,6 +84,8 @@ func TestEncodeDecode(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChecksumMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// We start with a pre-encoded invoice, which has a valid checksum.
|
||||
payReqString := []byte("ycyr8brdjic6oak3bemztc5nupo56y3itq4z5q4qxwb35orf7fmj5phw8bx148zzipg3rh6t1btadpnxf7z1mnfd76hsw1eaoca3ot4uyyyyyyyyydbibt79jo1o")
|
||||
|
||||
@ -96,6 +100,8 @@ func TestChecksumMismatch(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDecodeTooShort(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// We start with a pre-encoded too-short string.
|
||||
payReqString := "ycyr8brdji"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user