Closed stuartc closed 5 years ago
usually you would have a different/new connection to a database in test(s) which you could start / stop along with other resources in fixtures and then use use-fixtures :each
or use-fixtures :once
to start stop resources before or after tests:
(defn with-db [f]
(create-db)
(f)
(destroy-db))
(use-fixtures :each with-db)
this way every time boot test
runs new db connection will be created and destroyed to run the tests.
@tolitius awesome that makes a lot of sense, thank you!
Hi there!
I'm trying to get my database connection to be closed off between test runs. I appear to be collecting threads after each run, eventually eating up all my memory.
I've managed to make the situation a lot better by moving the connection inself into a
defstate
.However I can't quite figure out how to get
stop
to be called between test runs. Sinceboot watch
is reloading the code between runs, should I expectstop
to just be called automatically? Or do I need to extend/augment boot in order to ensure the state is stopped.The gist of my applications setup phase looks like this: