I am trying to allow my existing Postgres application to use Mysql, too. My current problem is this error when running tests with Mysql:
**** (RuntimeError) Ecto SQL sandbox transaction was already committed/rolled back.**
The sandbox works by running each test in a transaction and closing thetransaction afterwards. However, the transaction has already terminated.Your test code is likely committing or rolling back transactions manually,either by invoking procedures or running custom SQL commands.
Does this mean that I can not use transactions in my code when tests are run with Mysql and Ecto sandbox?
This seems like a concurrency issue, namely that the transaction has ended but the test still needed it?
If you can, post some code and maybe we can help.
Thank you. I will try to make this into a small example I can post, something that might take time.
Since the error goes away when I stop using sandbox and I am very late with this work item, the example has lower priority than making Mysql work without sandbox. If the Mysql problem returns outside of sandbox, the example will get higher prio.
Yep, work schedules are important but I’d urge you to solve this when you get a little free time because your tests might slow down and this might be noticed much later, when it’s more difficult to do anything about it.
Tech debt, you know.
Yes, it would be nice to solve the problem, instead of just removing the sandbox for Mysql during testing. Mainly because it might be something I am doing wrong and that it is only visible here, not in Postgres.