Closed toranb closed 5 years ago
You don't see an issue because you only have one test using the cluster. If you have 5 tests and call LocalCluster.start
in each one, it's going to have a large overhead against doing it once before your tests run. It runs before ExUnit
to guarantee that the library is correctly started before running any tests that depend on it. The README is written for the general case, as there's pretty much no benefit to doing it directly inside a test.
I was following the readme to the letter recently by running
LocalCluster.start
before myExUnit.start
in the test_helper (Phoenix) but ... strangely enough it turns out you can run theLocalCluster.start
in a single setup for just 1 test meaning theExUnit.start
can remain in the test_helper as you would see in any default application layout.Any reason we can't update the readme to reflect this^ world view?
note: working example app w/ my results to prove its fine running after
ExUnit.start
https://github.com/toranb/elixir-budget/commit/b657a1824dbc9db2f6ea4bf5ce62460173e4b423