bee-js icon indicating copy to clipboard operation
bee-js copied to clipboard

Parallel nature of tests execution and Bee's mutex for blockchain operations

Open AuHau opened this issue 2 years ago • 0 comments

Problem

Bee allows only one API call that create a blockchain transactions. Recently, they improved the API which now returns "429 Too Many Requests" if there is already pending transactions that awaits resolution.

Jest executes test in parallel using multi-execution environment (I believe it uses Worker Threads), which can lead to introduction of more flaky test environment if the blockchain-related integration tests will be executed in the same time.

To my understanding Jest paralelise the top level describe entities, while keeping everything in the describe serially executed (see here). Thanks to that we have not run into this issue, but if we gonna expand our integration testing this might become more important.

Solutions

Abond parallelism

Jest allows execute all tests in serial, but we would take a big hit on the performance (almost double the execution time).

External synchronization

From my brief research I have not find a way how to communicate between the workers to sync execution of only one blockchain test.

There is possibility to use file-system and have lock-file, yet I am not sure how good idea it is also from performance point of view.

Split blockchain-relate tests

We could refactor the blockchain related tests into separate group, which would be executed serially while all the other tests would be still kept running parallel.

AuHau avatar Oct 13 '21 13:10 AuHau