Conversation
055f648 to
f195c66
Compare
|
|
||
| When `testUtxos.length` drops below `REFILL_THRESHOLD` (default 10) | ||
| after a funding operation, the service triggers a background split of | ||
| the current `largeUtxo`. The split is delayed by 1.5 seconds to avoid |
There was a problem hiding this comment.
This wait X seconds for the tx to be accepted usually introduces race conditions, a solution we have on the wallet-lib itself is waiting for both wallets to receive the transaction, this way we always wait until it is ready to use again.
There was a problem hiding this comment.
The idea of having a buffer of transactions is exactly to prevent race conditions: the tests have another 1.5 seconds to request more transactions while the buffer is re-filled.
It is not necessary to wait for the tx to be received by the wallet, because the utxo is guaranteed to be isolated for that test alone.
If this becomes not enough we can increase the threshold to 20, for example. Another option, if the DevMiner ( #102 ) becomes efficient enough, is to reduce the delay from 1500ms to less than that.
| @@ -0,0 +1,439 @@ | |||
| - Feature Name: integration-test-helper | |||
There was a problem hiding this comment.
Unrelated to line
I got a couple os suggestions for the service:
Define a consistent error response schema, e.g.: { "error": "POOL_EXHAUSTED", "message": "No UTXOs available", "retryable": true }
This creates possible recoverable actions like retry and makes the reason of failure easier to spot.
Increate log observability with test names, meaning that on all requests we send the test name and the service logger will include the test name on the logs.
This way we can search for the test name and get the logs from their requests, this would make debugging any issues easier in the future
Define a standardized error response format with machine-readable codes, human-readable messages, and a retryable flag to enable smart retry logic in test harnesses.
Introduce an optional X-Test-Name header accepted by all endpoints. The service threads the test name through every log line for that request's lifecycle, enabling log search by test name when debugging failures in parallel test runs.
The Integration Test Helper is a dockerized HTTP service that provides race-condition-free wallet generation and funding for hathor-wallet-lib integration tests.
It pre-generates BIP39 wallets with derived addresses outside the test runtime (avoiding prohibitive address derivation costs under Jest) and splits the genesis block's single UTXO into a pool of independent, readily-available UTXOs so that parallel test executions never compete for funds.
See rendered.