Сбой приложения Phoenix на Heroku CI

Мы пытаемся перенести наш CI с Travis на Heroku. Все тесты проходят как локально, так и на Travis, но на Heroku мы получаем некоторые ошибки erlang, которые трудно отладить.

Все ошибки, похоже, возникают из-за тестов, в которых используется модуль Elixir Mock при имитации AWS S3. запрос.

Вот пример теста:

  test "put_object failure function" do
    with_mock ExAws, [request!: fn(_) -> %{status_code: 500} end] do
      res = S3.put_object("unique.png", "binary")
      assert res == {:error, "error uploading to S3"}
    end
  end

И помещенный объект просто:

  def put_object(unique, image_binary) do
    bucket = System.get_env("BUCKET_NAME")

    res = ExAws.S3.put_object(bucket, unique, image_binary)
    |> ExAws.request!

    case res do
      %{status_code: 200} ->
        {:ok, image_url(unique, bucket)}
      _ ->
        {:error, "error uploading to S3"}
    end
  end

Так что я не слишком уверен, что происходит не так.

Ошибки от Heroku CI здесь:

      8) test put_object failure function (Engine.S3Test)
         test/controllers/s3_test.exs:34
         ** (EXIT from #PID<0.1043.0>) 
{:compile_forms, {:error, [{[], [{:none, :compile, {:crash, :lint_module, {:badarg, [{:erlang, :atom_to_list, [[Application]], []}, 
{:erl_lint, :is_latin1_name, 1, [file: 'erl_lint.erl', line: 3050]}, {:erl_lint, :check_module_name, 3, [file: 'erl_lint.erl', line: 3043]}, 
{:erl_lint, :behaviour_callbacks, 3, [file: 'erl_lint.erl', line: 968]}, {:erl_lint, :all_behaviour_callbacks, 3, [file: 'erl_lint.erl', line: 929]}, 
{:erl_lint, :behaviour_check, 2, [file: 'erl_lint.erl', line: 916]}, {:erl_lint, :post_traversal_check, 2, [file: 'erl_lint.erl', line: 888]}, {:erl_lint, :module, 3, [file: 'erl_lint.erl', line: 534]}, {: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]}]}}}]}], []}}

person JMurphyWeb    schedule 24.10.2017    source источник
comment
Похоже на github.com/jjh42/mock/issues/66. Вы используете последнюю версию mock/meck?   -  person Dogbert    schedule 24.10.2017
comment
Это отличное место! Сейчас разберусь!   -  person JMurphyWeb    schedule 24.10.2017
comment
Это уладило дело. Обновите пробную версию до 0.3.1 - {:mock, "~> 0.3.1", only: :test} Спасибо @Dogbert   -  person JMurphyWeb    schedule 24.10.2017


Ответы (1)


Это отсортировано благодаря ответу @Dogbert здесь

Обновить фиктивную версию до 0.3.1 - {:mock, "~> 0.3.1", only: :test}

person JMurphyWeb    schedule 24.10.2017