ExUnit async: true {:error, :table_not_found} with Ash.DataLayer.Ets
I've recently done a refactor on a test suite to allow all cases to run asynchronously. Unfortunately at some point I've started getting intermittent
:table_not_found
errors thrown on the actions of an Ets backed resource. It's almost guaranteed to happen when the whole suite (200+ tests) runs asynchronously. Is this expected? Meaning Ash.DataLayer.Ets
isn't ready/meant to be used with asynchronous tests or am I missing some proper setup?
For reference, these Ets backed resources serve as an in-memory cache to avoid hitting the DB constantly. The main use-case is to cache actor/account permissions to be used by policies.11 Replies
Not expected, no. We use ETS for all of our Ash testing and I've not seen that before
Pretty strange
I can't think of why it would happen at this point. Is there anything special you can think of about your setup?
here's an overview of how it is being used. the error is happening in the line with
Logger.warning("error fetching cache:")
What's the stack trace of the error?
Interesting. Do you have the disable async config set in test? https://hexdocs.pm/ash/testing.html
yes, I've followed both guidelines for Ash and for Ecto.Adapters.SQL.Sandbox with Postgres
Very very strange 🤔
All access to that stuff ought to be creating the tables before-hand etc.
indeed, from a quick look at the source code that was also my (limited) conclusion
this is not a showstopper as it's only happening in the test suite and I can easily ignore it
although I reckon it would be hard to try and create a minimum reproducible example for this
Are the stack traces the same in all cases?
You might try cloning down
ash
and putting some debug code in the ets logicyes it's the same stacktrace all the time
I'll let you know if I find some free time to do that 👍