budgie
Test fixture persistence with NoSQL DBs in Phoenix and Ecto? (Unique constraint violations)
I’m using ArangoDB through the arangox_ecto package. I had to remove the ecto_sql package to get things to work properly. I’m still having trouble with the persistence of test fixtures, as they are not removed from the database between tests. This means that when another test tries to create the same test fixture, I get a unique constraint violation.
How can I fix this so that the fixtures are cleaned up properly, as happens with the SQL Sandbox adapter.
@TomGrozev if you see this I’d love your input.
Most Liked
jstimps
I’ve had success with async unit testing a NoSQL DB with Ecto by using a new tenant for each TestCase. The TestCase then deletes the tenant after the test execution. It works well if the db supports lightweight tenants. I’m not familiar with the features of ArangoDB though.
TomGrozev
Version 2.0 of arangox_ecto now includes a Sandbox like in ecto_sql so tests can be done in transactions which automatically rollback. Using this would resolve the test fixtures as it can be reset to a known state at the start of the tests.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









