Skip to content

Commit

Permalink
itest: reduce proof courier ack timeout
Browse files Browse the repository at this point in the history
Since we reduced the node startup time delay during itests in a previous
commit (a2a95e7) by removing a one second wait, we can now also
decrease the wait time for a receiver to send an ACK after a restart as
well. This shaves off around 15 seconds of our itests.
  • Loading branch information
guggero committed Mar 4, 2024
1 parent 36179d6 commit 1e8eaf2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
32 changes: 26 additions & 6 deletions itest/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

var (
transferTypeSend = taprpc.ProofTransferType_PROOF_TRANSFER_TYPE_SEND
timeoutMargin = 5 * time.Second
)

// testBasicSendUnidirectional tests that we can properly send assets back and
Expand Down Expand Up @@ -71,6 +72,11 @@ func testBasicSendUnidirectional(t *harnessTest) {
}

timeout := 2 * defaultProofTransferReceiverAckTimeout

// Allow for some margin for the operations that aren't pure
// waiting on the receiver ACK.
timeout += timeoutMargin

ctx, cancel := context.WithTimeout(ctxb, timeout)
defer cancel()
assertAssetSendNtfsEvent(
Expand Down Expand Up @@ -185,6 +191,11 @@ func testRestartReceiverCheckBalance(t *harnessTest) {
}

timeout := 2 * defaultProofTransferReceiverAckTimeout

// Allow for some margin for the operations that aren't pure
// waiting on the receiver ACK.
timeout += timeoutMargin

ctx, cancel := context.WithTimeout(ctxb, timeout)
defer cancel()
assertAssetSendNtfsEvent(
Expand Down Expand Up @@ -643,8 +654,11 @@ func testReattemptFailedSendHashmailCourier(t *harnessTest) {
// Context timeout scales with expected number of events.
timeout := time.Duration(expectedEventCount) *
defaultProofTransferReceiverAckTimeout
// Add overhead buffer to context timeout.
timeout += 5 * time.Second

// Allow for some margin for the operations that aren't pure
// waiting on the receiver ACK.
timeout += timeoutMargin

ctx, cancel := context.WithTimeout(ctxb, timeout)
defer cancel()

Expand Down Expand Up @@ -750,8 +764,11 @@ func testReattemptFailedSendUniCourier(t *harnessTest) {
// Context timeout scales with expected number of events.
timeout := time.Duration(expectedEventCount) *
defaultProofTransferReceiverAckTimeout
// Add overhead buffer to context timeout.
timeout += 5 * time.Second

// Allow for some margin for the operations that aren't pure
// waiting on the receiver ACK.
timeout += timeoutMargin

ctx, cancel := context.WithTimeout(ctxb, timeout)
defer cancel()

Expand Down Expand Up @@ -913,8 +930,11 @@ func testReattemptFailedReceiveUniCourier(t *harnessTest) {
// Context timeout scales with expected number of events.
timeout := time.Duration(expectedEventCount) *
defaultProofTransferReceiverAckTimeout
// Add overhead buffer to context timeout.
timeout += 5 * time.Second

// Allow for some margin for the operations that aren't pure
// waiting on the receiver ACK.
timeout += timeoutMargin

ctx, cancel := context.WithTimeout(ctxb, timeout)
defer cancel()

Expand Down
2 changes: 1 addition & 1 deletion itest/tapd_harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const (
// defaultProofTransferReceiverAckTimeout is the default itest specific
// timeout we'll use for waiting for a receiver to acknowledge a proof
// transfer.
defaultProofTransferReceiverAckTimeout = 5 * time.Second
defaultProofTransferReceiverAckTimeout = 500 * time.Millisecond
)

// tapdHarness is a test harness that holds everything that is needed to
Expand Down

0 comments on commit 1e8eaf2

Please sign in to comment.