The failures happen randomly and are caused by concurrency issues:
The exact cause is the update tasks in that test, such as UpdateBookRatingTask or UpdateBookTotalSoldTask. Those tasks execute concurrently, and they pick an entity ID randomly to perform the update on. In smoke tests, there are very few entities (10, I think) and thus a conflict is very likely.
I see three potential solutions:
1. Add a synchronization of some sort to avoid ending up in a situation where two tasks work on the same ID
2. Disable concurrency in smoke tests, so that the main build won't be affected by the issue
3. Mitigate the issue by ensuring that N consecutive requests for a random entity ID will always return N unique IDs (but requests separated by more than N calls may still result in the same ID).
#3 is not an absolute solution, but if it should work if N is much higher than the number of threads, and if all tasks requesting a random ID have a similar execution time.
: unless you have an objection, I'll go with solution #3, which I think balances benefits and runtime costs best.