Testing Setups?

Greetings,
I am new to all this, but I have watched a ton of videos, so please forgive my ignorance…

I am working from the ions-starter project, and have it setup and working. I am now trying to figure out the best practices around development and testing. So I set the the following task in front of my self, create a test that adds new attributes and a new type, add some data, execute a query and tear it down.

I am perfectly happy running “on line”, so I am not asking for off-line support or anything.

I have come up with the following pattern for this test:

  1. check to see if the test DB exists, delete it if it does.
  2. create test DB.
  3. Add my data.
  4. Run queries, etc.

and it works, if I execute each form in a repl, one at a time. However, when I run them all at once, I get the following error:

“Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
:db.error/db-deleted 97cdaa80-43ee-4c45-8ce7-87de428ce508 has been deleted”

And this makes me think, my general approach is wrong, creating and nuking a DB for a set of tests (this is a pattern I admittedly inherited from Java land).

So, besides figuring out a workaround for the above error, what is the idiomatic workflow for writing tests with Datomic Ions, especially those that include migration steps?

This question seems to be un-google-able (by me), so I would really appreciate some pointers.

Thanks!
-Lucas

Sounds like a racing condition.

Personally I use a framework to manage migrations and components.

Side effects are isolated in local boundaries.

It’s not perfect but makes my life easier.

Thanks hden, I will give those a look.