diff --git a/itest/send_test.go b/itest/send_test.go index a0fa47b8e9..a56d7737f9 100644 --- a/itest/send_test.go +++ b/itest/send_test.go @@ -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 @@ -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( @@ -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( @@ -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() @@ -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() @@ -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() diff --git a/itest/tapd_harness.go b/itest/tapd_harness.go index 20068d369d..717449142f 100644 --- a/itest/tapd_harness.go +++ b/itest/tapd_harness.go @@ -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