Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,21 @@ jobs:
run: mix deps.get && mix deps.unlock --check-unused
if: ${{ matrix.lint }}

- name: Check formatting
run: mix format --check-formatted
if: ${{ matrix.lint }}

- name: Compile with --warnings-as-errors
run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}

- name: Run tests
run: mix test --warnings-as-errors
if: ${{ matrix.lint }}

- name: Run tests
run: mix test
if: ${{ !matrix.lint }}

test_older_elixir:
runs-on: ubuntu-22.04
Expand Down
16 changes: 15 additions & 1 deletion test/http_client_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
defmodule Tzdata.HTTPClientTest do
use ExUnit.Case, async: true

import ExUnit.CaptureLog

@url "https://data.iana.org/time-zones/tzdata-latest.tar.gz"

test "Httpc client can HEAD the IANA tzdata URL over verified HTTPS, when it can verify certificates" do
Expand All @@ -17,7 +19,19 @@ defmodule Tzdata.HTTPClientTest do
end

test "Hackney client can HEAD the IANA tzdata URL over verified HTTPS" do
assert {:ok, {200, headers}} = Tzdata.HTTPClient.Hackney.head(@url, [], [])
# Hackney support is deprecated: call it via `apply/3` so the compiler's
# static `@deprecated` check doesn't fire, and capture the runtime
# deprecation log it emits, since triggering both here is expected.
# `capture_log/2` (rather than `with_log/1`, added in Elixir 1.13) keeps
# this working on the oldest Elixir version this library supports.
log =
capture_log(fn ->
send(self(), {:head_result, apply(Tzdata.HTTPClient.Hackney, :head, [@url, [], []])})
end)

assert_received {:head_result, result}
assert {:ok, {200, headers}} = result
assert Enum.any?(headers, fn {k, _v} -> String.downcase(k) == "content-length" end)
assert log =~ "Hackney"
end
end
Loading