Trying to run all tests on my app yields "too many open files" error

I'm building a reasonably small web app in Clojure and trying to run all the tests in order to get code coverage, but if I try to run them all, I get "too many open files" errors from elasticsearch.

I have already tried raising my system limits. I've also tried adding the JVM option "-XX:-MaxFDLimit". Neither has had an effect.

I understand that elasticsearch needs a certain number of files, but I'm confused about why it would need so many for my unit tests. Probably this means a test is behaving badly, but I'm not sure how to narrow it down, since the error doesn't occur on the same test every time.

Welcome to our community! :smiley:

Can you please share the full error, and your elasticsearch.yml.