Skip to content

Commit 19330e8

Browse files
committed
itest: add delay after SubscribeSendEvents in sendAsset helper
The AssertSendEvents check in this function occasionally fails, reporting that the first received event is SendStateVirtualCommitmentSelect instead of the expected SendStateStartHandleAddrParcel. This likely occurs because the SubscribeSendEvents RPC returns before the stream is fully initialized with the ChainPorter. As a result, the SendAsset call may emit the first event before the stream listener is ready to receive it.
1 parent b3634cd commit 19330e8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

itest/addrs_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,15 @@ func sendAsset(t *harnessTest, sender *tapdHarness,
10131013
options.sendAssetRequest.SkipProofCourierPingCheck = true
10141014
}
10151015

1016+
// The SubscribeSendEvents call returns immediately, but the server may
1017+
// still be setting up its event stream. If we emit an event too soon,
1018+
// it may be lost. We wait briefly to allow the server time to complete
1019+
// setup.
1020+
//
1021+
// TODO(ffranr): Remove this once the server supports buffering or
1022+
// replaying early events for new subscribers.
1023+
time.Sleep(time.Second)
1024+
10161025
// Kick off the send asset request.
10171026
resp, err := sender.SendAsset(ctxt, &options.sendAssetRequest)
10181027
if options.errText != "" {

0 commit comments

Comments
 (0)