the more tests I write, the more deadlocks I run into
The LLM wants to add max_cases to
ExUnit.start(max_cases: 2)
and shrink the config/test.ex
App.Repo pool_size.
I feel like these are bandaids and there's something fundamentally wrong with my test suite. Any tips/tricks for things to look for? Some anti-patterns in my generators.ex functions?
Solution:Jump to solution
Like
email: StreamData.repeatedly(fn -> "email#{System.unique_integer()}@example.com" end)
6 Replies
It likely comes from producing non unique data across your various tests
Use
System.unique_integer
instead of sequence
and see if that helps
Like with `StreamData.repeatedly'there might be some generators with nested StreamData
is this a DB sequence?
https://hexdocs.pm/ash/3.5.25/Ash.Generator.html#sequence/3
No it's a process local unique data generator
Nested stream data is totally fine
Can you clarify what is meant by stream data repeatedly?
Solution
Like
email: StreamData.repeatedly(fn -> "email#{System.unique_integer()}@example.com" end)
ah ok, looking at my generators I have a lot of those too
I took
StreamData.repeatedly
to mean StreamData repeatedly
🤦♂️
updated the generators as suggested, remove max_case:2 and set pool_size back to pool_size: System.schedulers_online() * 2
tests are running without dead locks AND faster.
You're a wizard Harry!!