tompave
Meck compilation failures with OTP 20.0
I use mock 0.2.1 in my ExUnit test suite. Tests pass with Elixir 1.4 (1.4.4 and 1.4.5) and OTP 18.3, 19.3 and 20.0-rc1, but I get errors with OTP 20.0. The errors happen in some, but not all, tests that create mocks.
The error is always the same but the stacktrace is not always present:
** (ErlangError) erlang error: {:compile_forms, {:error, [{[], [{:none, :compile, {:crash, :lint_module, {:badarg, [{:erlang, :atom_to_list, [[GenServer]], []}, {:erl_lint, :is_latin1_name, 1, [file: 'erl_lint.erl', line: 3055]}, {:erl_lint, :check_module_name, 3, [file: 'erl_lint.erl', line: 3048]}, {:erl_lint, :behaviour_callbacks, 3, [file: 'erl_lint.erl', line: 973]}, {:erl_lint, :all_behaviour_callbacks, 3, [file: 'erl_lint.erl', line: 934]}, {:erl_lint, :behaviour_check, 2, [file: 'erl_lint.erl', line: 921]}, {:erl_lint, :post_traversal_check, 2, [file: 'erl_lint.erl', line: 893]}, {:erl_lint, :module, 3, [file: 'erl_lint.erl', line: 536]}, {:compile, :lint_module, 2, [file: 'compile.erl', line: 1109]}, {:compile, :"-internal_comp/5-anonymous-1-", 3, [file: 'compile.erl', line: 342]}, {:compile, :fold_comp, 4, [file: 'compile.erl', line: 369]}, {:compile, :internal_comp, 5, [file: 'compile.erl', line: 353]}, {:compile, :"-do_compile/2-anonymous-0-", 2, [file: 'compile.erl', line: 177]}, {:compile, :"-do_compile/2-anonymous-1-", 1, [file: 'compile.erl', line: 190]}]}}}]}], []}}
stacktrace:
(meck) src/meck_proc.erl:95: :meck_proc.start(MyMocked.ModuleFoo, [:passthrough])
test/my_mocked/module_foo_test.exs:395: anonymous fn/2 in MyMocked.ModuleFooTest.test the test description I typed for this specific test case/1
(elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
test/my_mocked/module_foo_test.exs:395: (test)
It looks like sometimes the mocks are not cleared and “leak” in other tests, judging from this other kind of errors that happens randomly:
** (UndefinedFunctionError) function Foo.Bar.baz/0 is undefined or private. Did you mean one of:
* baz/0
You can inspect the failures on the Travis build. I’ve setup a broad test matrix to show that the problem was introduced between OTP 20.0-rc1 and the final 20.0.
I have raised an issue on the Mock project, but this looks more like an Elixir and Erlang issue. I would appreciate some guidance before opening an issue on the Elixir-lang repo.
Thank you!
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









