凤凰应用程序在Heroku CI上崩溃
我们正在尝试将CI从Travis转移到Heroku。测试都在本地和Travis上通过,但在Heroku上我们得到了一些难以调试的erlang错误 所有的错误似乎都是在模拟AWS S3请求时使用Elixir模块的测试中产生的 下面是一个示例测试:凤凰应用程序在Heroku CI上崩溃,heroku,erlang,elixir,phoenix-framework,heroku-ci,Heroku,Erlang,Elixir,Phoenix Framework,Heroku Ci,我们正在尝试将CI从Travis转移到Heroku。测试都在本地和Travis上通过,但在Heroku上我们得到了一些难以调试的erlang错误 所有的错误似乎都是在模拟AWS S3请求时使用Elixir模块的测试中产生的 下面是一个示例测试: test "put_object failure function" do with_mock ExAws, [request!: fn(_) -> %{status_code: 500} end] do res = 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
put对象就是:
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]}]}}}]}], []}}
8)测试put\u对象故障功能(Engine.S3Test)
测试/控制器/s3_测试。exs:34
**(退出#PID)
{:compile_forms,{:error,[{:none,:compile,{:crash,:lint_module,{:badarg,[{:erlang,:atom_to_list,[[Application]],[]},
{:erl_lint,:is_latin1_name,1,[文件:'erl_lint.erl',行:3050]},{:erl_lint,:check_module_name,3,[文件:'erl_lint.erl',行:3043]},
{:erl_lint,:behavior_回调,3,[文件:'erl_lint.erl',第968行]},{:erl_lint,:all_behavior_回调,3,[文件:'erl_lint.erl',第929行],
{:erl_lint,:behavior_check,2,[文件:'erl_lint.erl',行:916]},{:erl_lint,:post_遍历检查,2,[文件:'erl_lint.erl',行:888]},{:erl_lint,:module,3,[文件:'erl_lint lint.erl',534]},编译,{:编译,:lint模块,2,[文件:'compile compile.erl',行:1109]},编译:“-internal compile comp compile-compute/5-”,匿名,[文件:'342],',{:compile,:fold_comp,4,[文件:'compile.erl',行:369]},{:compile,:internal_comp,5,[文件:'compile.erl',行:353]},
{:compile,:“-do_compile/2-anonymous-0-”,2,[文件:'compile.erl',行:177]},{:compile,:“-do_compile/2-anonymous-1-”,1,[文件:'compile.erl',行:190]}],]}
感谢@Dogbert的回答
将模拟版本更新为0.3.1-
{:mock,~>0.3.1',仅::test}
看起来像这样。您是否使用最新版本的mock/meck?这是一个很棒的地点!我现在会调查的!那就对了。将模拟版本更新为0.3.1-{:mock,“~>0.3.1”,仅限::test}
谢谢@Dogbert