tompave

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!

First Post!

tompave

tompave

It seems to be caused by an issue with meck. More details here.

Where Next?

Popular in Questions Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2, I would like to get: ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <%= ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42158 114
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127536 1222
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New

We're in Beta

About us Mission Statement