Make the IDs deterministic and guaranteed to be unique
Context for reviewers
Since the IDs were random, there was a small chance (but higher than you might intuitively expect!) of generating a collision. This would trigger integrity errors or cause the behavior of the test to be not what you'd expect (a new "insert" would actually be a "modify", for example)
Testing
First, (temporarily) add pytest-repeat:
poetry add pytest-repeat
Then run the test several thousand times:
make test args="tests/src/db/test_bulk_ops.py --count 2500"
You should observe some failures because a duplicate ID is generated:
Ticket
n/a
Changes
Context for reviewers
Testing
First, (temporarily) add pytest-repeat:
poetry add pytest-repeat
Then run the test several thousand times:make test args="tests/src/db/test_bulk_ops.py --count 2500"
You should observe some failures because a duplicate ID is generated:Then, re-run after applying the patch: