Unit Tests Crash on CI

I have and umbrella project with about 30000 lines of code that run all the tests inside Drone CI, the tests run ok on the local machine, but in drone they crash with this stacktrace

** (ArgumentError) argument error
166 (stdlib) :ets.take(ExUnit.OnExitHandler, #PID<0.6751.0>)
167 (ex_unit) lib/ex_unit/on_exit_handler.ex:56: ExUnit.OnExitHandler.run/2
168 (ex_unit) lib/ex_unit/runner.ex:363: ExUnit.Runner.exec_on_exit/3
169 (ex_unit) lib/ex_unit/runner.ex:199: ExUnit.Runner.spawn_module/3
170 (ex_unit) lib/ex_unit/runner.ex:130: ExUnit.Runner.run_module/2
171
172 ....=ERROR REPORT==== 29-Jul-2019::14:22:29.247856 ===
173 Error in process <0.6751.0> with exit value:
174 {badarg,
175 [{ets,take,['Elixir.ExUnit.OnExitHandler',<0.6759.0>],[]},
176 {'Elixir.ExUnit.OnExitHandler',run,2,
177 [{file,"lib/ex_unit/on_exit_handler.ex"},{line,56}]},
178 {'Elixir.ExUnit.Runner',exec_on_exit,3,
179 [{file,"lib/ex_unit/runner.ex"},{line,363}]},
180 {'Elixir.ExUnit.Runner',run_test,3,
181 [{file,"lib/ex_unit/runner.ex"},{line,246}]},
182 {'Elixir.ExUnit.Runner','-run_tests/3-fun-0-',4,
183 [{file,"lib/ex_unit/runner.ex"},{line,235}]},
184 {'Elixir.Enumerable.List',reduce,3,[{file,"lib/enum.ex"},{line,3317}]},
185 {'Elixir.Enum',reduce_while,3,[{file,"lib/enum.ex"},{line,1990}]},
186 {'Elixir.ExUnit.Runner','-spawn_module_monitor/4-fun-1-',4,
187 [{file,"lib/ex_unit/runner.ex"},{line,211}]}]}

It is pretty weird and the cause is not clear, the unit tests do not fail locally but they crash on the CI

Hard to judge from the stacktrace only, but I would recommend to first double check if on CI you are using the same Elixir and Erlang/OTP versions as in your local environment.

2 Likes

Yes we are using Elixir 1.8.1 and Erlang 21.1