kit-clj / kit

Lightweight, modular framework for scalable web development in Clojure
https://kit-clj.github.io/
MIT License
476 stars 44 forks source link

adds teardown step for test system-fixture #118

Closed ajakate closed 11 months ago

ajakate commented 11 months ago

I noticed that the system-fixture was missing a teardown step for testing.

I added a few high level API tests for my hobby project with mock.ring.request and used utils/system-fixture and utils/system-state from the test_utils.clj to configure my database and handler. The tests passed, but I noticed that when I ran clj -X:test from the CLI the process would hang, or if ran the (run-tests) function in the repl mutiple times I would get a "bind address already in use" error.

I figure the fixture starts up the whole integrant system including the http-server, which doesn't exit. In any case, adding this teardown step worked locally for me, and seems to align with the practices listed on the use-fixtures documentation.

I don't know clojure super well yet so not sure if there is a better way to be doing this, but figured I would open a PR since this was helpful for me.

yogthos commented 11 months ago

Oh yeah, that's a good catch and thanks for doing the PR!