Skip to content

Fix mix test on Elixir 1.18 #993

@unflxw

Description

@unflxw

On Elixir 1.18, running mix test will now run the extension installation Mix task. However, it will attempt to run it in test mode, with our test configuration, which points at fake modules. Those fake modules expect their corresponding processes to have been started by their ExUnit test, but they haven't been, so it crashes:

> mix test
** (exit) exited in: GenServer.call(FakeSystem, {:get, #Function<0.38303420/1 in FakeSystem.get/2>}, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir 1.18.2) lib/gen_server.ex:1121: GenServer.call/3
    test/support/fake_system.ex:5: FakeSystem.cmd/3
    mix_helpers.exs:739: Mix.Appsignal.Helper.uid/0
    mix_helpers.exs:734: Mix.Appsignal.Helper.root?/0
    mix_helpers.exs:550: Mix.Appsignal.Helper.initial_report/0
    mix_helpers.exs:25: Mix.Appsignal.Helper.install/0
    mix.exs:10: Mix.Tasks.Compile.Appsignal.run/1
    (mix 1.18.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5

See #992 for a workaround, which is not a proper fix. See also Slack conversation for context.

Reproduce

  • Upgrade to Elixir 1.18
  • Run mix test (this will work if mix compile hasn't been ran yet, as it will cause mix test to run the installation Mix task in non-test mode)
  • Run mix test again, which will attempt to run the installation Mix task in test mode and fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed and unconfirmed bugs reported by us and customers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions