From a1f11a0a83a17eeaf5e256d0f1f6002a17f2f764 Mon Sep 17 00:00:00 2001 From: Pablo Costas Date: Tue, 12 May 2020 18:50:21 +0200 Subject: [PATCH] Fix build failure due to `:connect_timeout` from poster --- lib/excoveralls/poster.ex | 2 +- test/poster_test.exs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/excoveralls/poster.ex b/lib/excoveralls/poster.ex index f88ba4c3..c6e6d4e7 100644 --- a/lib/excoveralls/poster.ex +++ b/lib/excoveralls/poster.ex @@ -51,7 +51,7 @@ defmodule ExCoveralls.Poster do body })."} - {:error, :timeout} -> + {:error, reason} when reason in [:timeout, :connect_timeout] -> {:ok, "Unable to upload the report to '#{endpoint}' due to a timeout. Not failing the build."} {:error, reason} -> diff --git a/test/poster_test.exs b/test/poster_test.exs index 7e10e541..a5e07911 100644 --- a/test/poster_test.exs +++ b/test/poster_test.exs @@ -15,7 +15,8 @@ defmodule PosterTest do end end - test_with_mock "post json timeout", :hackney, [request: fn(_, _, _, _, _) -> {:error, :timeout} end] do + test_with_mock "post json timeout", :hackney, [request: fn(_, _, _, _, _) -> {:error, :timeout} end, + request: fn(_, _, _, _, _) -> {:error, :connect_timeout} end] do assert capture_io(fn -> assert ExCoveralls.Poster.execute("json") == :ok end) =~ ~r/timeout/