2017-10-24 8 views
2

우리는 CI를 Travis에서 Heroku로 이식하려고합니다. 테스트는 모두 로컬과 Travis 모두에서 통과하지만 Heroku에서는 디버깅하기 어려운 일부 오류가 발생합니다.Heroku CI에서 Phoenix 앱이 충돌 함

모든 오류는 AWS3 요청을 조롱하면서 Elcomir Mock 모듈을 사용하는 테스트에서 발생하는 것으로 보입니다. 여기

는 예를 들어, 테스트입니다 :

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]}]}}}]}], []}} 
+1

은 HTTPS 것 같은데 : // github.com/jjh42/mock/issues/66. 최신 버전의 mock/meck에 있습니까? – Dogbert

+0

그게 좋은 장소 야! 그것으로 지금 보일 것입니다! – JMurphyWeb

+0

그걸 정렬했습니다. mock 버전을 0.3.1로 업데이트하십시오. -'{: mock, "~> 0.3.1", only : : test}' Thanks @Dogbert – JMurphyWeb

답변

0

이 덕분에 0.3.1에 @ Dogbert의 대답 here

업데이트 모의 버전으로 분류되어 그 {:mock, "~> 0.3.1", only: :test}