diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c9ea617..c4e56836 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +0.14.6 +------ +#### Changes +- Survive coveralls maintenance and outagle (#283). + - Better handling of coveralls.io errors (ex. 405, 500 status codes). + 0.14.5 ------ #### Enhancements diff --git a/README.md b/README.md index 6a5bae3c..03edcc58 100644 --- a/README.md +++ b/README.md @@ -468,6 +468,18 @@ defmodule MyModule do end ``` +### Silence OTP Cover Warnings +To remove OTP warnings about modules or specific logging, you can copy the `cover.erl` file under `src/` of your Elixir project and modify it to remove the warnings, as a tentative solution. + +- Remove the 2 lines below to remove the "WARNING: Module already imported from ..." log +https://github.com/erlang/otp/blob/131398b54cca5f1ae95ed268274936d2efde8c39/lib/tools/src/cover.erl#L1553-L1554 + +- If you do not want the imported info cluttering your test output, replace the function in https://github.com/erlang/otp/blob/131398b54cca5f1ae95ed268274936d2efde8c39/lib/tools/src/cover.erl#L1520-L1525 with +``` +imported_info(_Text,_Module,_Imported) -> + ok. +``` + ### Notes - If mock library is used, it will show some warnings during execution. - https://github.com/eproxus/meck/pull/17 diff --git a/lib/excoveralls/poster.ex b/lib/excoveralls/poster.ex index fba50f3d..fca0a6ec 100644 --- a/lib/excoveralls/poster.ex +++ b/lib/excoveralls/poster.ex @@ -43,6 +43,10 @@ defmodule ExCoveralls.Poster do {:ok, status_code, _, _} when status_code in 200..299 -> {:ok, "Successfully uploaded the report to '#{endpoint}'."} + {:ok, 500 = _status_code, _, _client} -> + {:ok, "API endpoint `#{endpoint}` is not available and return internal server error! Ignoring upload"} + {:ok, 405 = _status_code, _, _client} -> + {:ok, "API endpoint `#{endpoint}` is not available due to maintenance! Ignoring upload"} {:ok, status_code, _, client} -> {:ok, body} = :hackney.body(client) diff --git a/mix.exs b/mix.exs index 660f6035..dcf40ad2 100644 --- a/mix.exs +++ b/mix.exs @@ -6,7 +6,7 @@ defmodule ExCoveralls.Mixfile do def project do [ app: :excoveralls, - version: "0.14.5", + version: "0.14.6", elixir: "~> 1.3", elixirc_paths: elixirc_paths(Mix.env()), deps: deps(), diff --git a/test/poster_test.exs b/test/poster_test.exs index a5e07911..ad3952e2 100644 --- a/test/poster_test.exs +++ b/test/poster_test.exs @@ -21,4 +21,16 @@ defmodule PosterTest do assert ExCoveralls.Poster.execute("json") == :ok end) =~ ~r/timeout/ end + + test_with_mock "post json fails due internal server error", :hackney, [request: fn(_, _, _, _, _) -> {:ok, 500, "", ""} end] do + assert capture_io(fn -> + assert ExCoveralls.Poster.execute("json") == :ok + end) =~ ~r/internal server error/ + end + + test_with_mock "post json fails due to maintenance", :hackney, [request: fn(_, _, _, _, _) -> {:ok, 405, "", ""} end] do + assert capture_io(fn -> + assert ExCoveralls.Poster.execute("json") == :ok + end) =~ ~r/maintenance/ + end end