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
45 changes: 29 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,52 @@ jobs:
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v1
- uses: actions/setup-elixir@v1.2.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1
with:
otp-version: 22.2
elixir-version: '1.10'
otp-version: '25.3.2'
version-type: strict
elixir-version: '1.15.7'
- name: Install dependencies
run: mix deps.get
- name: Check format
run: mix format --check-formatted
test:
name: OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }}
name: Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}
runs-on: ubuntu-latest
container:
image: hexpm/elixir:${{ matrix.elixir }}-erlang-${{ matrix.otp }}-debian-bullseye-20210902-slim
strategy:
fail-fast: false
matrix:
otp: [22.2]
elixir: [1.6, 1.7, 1.8, 1.9, '1.10']
include:
- elixir: '1.6.6'
otp: '21.3.8.24'
- elixir: '1.7.4'
otp: '22.3.4.26'
- elixir: '1.8.2'
otp: '22.3.4.26'
- elixir: '1.9.4'
otp: '22.3.4.26'
coverage: true
- elixir: '1.10.4'
otp: '22.3.4.26'
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v1.0.0
- uses: actions/setup-elixir@v1.2.0
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Install git
run: |
sed -i '/security.debian.org/d' /etc/apt/sources.list
apt-get update -y && apt-get install -y git
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up dependency cache
uses: actions/cache@v1
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: deps/
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-deps-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-deps-
- name: Set up build cache
uses: actions/cache@v1
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: _build/test/
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-${{ hashFiles('**/mix.lock') }}
Expand All @@ -63,10 +76,10 @@ jobs:
mix deps.compile
mix compile --force --warnings-as-errors
- name: Run tests
if: matrix.elixir != '1.9'
if: '!matrix.coverage'
run: mix test
- name: Run tests (with coverage)
if: matrix.elixir == '1.9'
if: matrix.coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mix coveralls.github
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
release:
types: [created]
jobs:
publish:
name: Hex Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # v1.18.2
with:
otp-version: '25.3.2'
version-type: strict
elixir-version: '1.14.4'
- name: Build
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Publish
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: |
mix hex.publish --yes
4 changes: 1 addition & 3 deletions lib/thrift/binary/framed/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ defmodule Thrift.Binary.Framed.Client do
TApplicationException.exception(
type: :bad_sequence_id,
message:
"Invalid sequence id. The client sent #{seq_id}, but the server replied with #{
mismatched_seq_id
}"
"Invalid sequence id. The client sent #{seq_id}, but the server replied with #{mismatched_seq_id}"
)

{:error, {:exception, exception}}
Expand Down
12 changes: 3 additions & 9 deletions lib/thrift/binary/framed/protocol_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ defmodule Thrift.Binary.Framed.ProtocolHandler do
{:error, reason} ->
# :ssl.format_error handles posix errors as well as ssl errors
Logger.info(fn ->
"#{inspect(handler_module)} (#{inspect(self())}) connection error: #{
:ssl.format_error(reason)
} (#{inspect(reason)})"
"#{inspect(handler_module)} (#{inspect(self())}) connection error: #{:ssl.format_error(reason)} (#{inspect(reason)})"
end)

:ok = transport.close(socket)
Expand All @@ -97,9 +95,7 @@ defmodule Thrift.Binary.Framed.ProtocolHandler do

{:error, reason} ->
Logger.info(fn ->
"#{inspect(handler_module)} (#{inspect(self())}) handshake error: #{
:ssl.format_error(reason)
} (#{inspect(reason)})"
"#{inspect(handler_module)} (#{inspect(self())}) handshake error: #{:ssl.format_error(reason)} (#{inspect(reason)})"
end)
end
end
Expand Down Expand Up @@ -156,9 +152,7 @@ defmodule Thrift.Binary.Framed.ProtocolHandler do
{:error, reason} ->
# :ssl.format_error handles posix error as well as ssl
Logger.info(fn ->
"#{inspect(handler_module)} (#{inspect(self())}) connection error: #{
:ssl.format_error(reason)
} (#{inspect(reason)})"
"#{inspect(handler_module)} (#{inspect(self())}) connection error: #{:ssl.format_error(reason)} (#{inspect(reason)})"
end)

:ok = transport.close(socket)
Expand Down
2 changes: 1 addition & 1 deletion lib/thrift/transport/ssl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule Thrift.Transport.SSL do
credentials or to change the configuration during run time.
"""

@type configure :: {module, function, list} | (() -> {:ok, [option]} | {:error, Exception.t()})
@type configure :: {module, function, list} | (-> {:ok, [option]} | {:error, Exception.t()})
@type option ::
:ssl.ssl_option() | {:enabled, boolean} | {:optional, boolean} | {:configure, configure}

Expand Down
18 changes: 18 additions & 0 deletions test/support/certs/cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-----BEGIN CERTIFICATE-----
MIIC9jCCAd6gAwIBAgIUM92EVZKERJ6W6ZrhwSyYZEh5CrIwDQYJKoZIhvcNAQEL
BQAwEjEQMA4GA1UEAwwHVGVzdCBDQTAeFw0yNjEwMjExOTIxMzNaFw0zNjEwMTgx
OTIxMzNaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBAJvGmT+QGsB4ueHnqttoRH/pPD7q7xKj1cZEPWHegDPwgcxJ
cvGwbSEpbURoYYX1a4yYjTtH6b1Q4ob5LbuF5QBw/5FGdvuhraZqjVK4D7wRTmSQ
2EPrrmUVq8DleI2dpUvbKkAOJGtoeBHbuabxGDc+AQh92gBul83/rtTi9IVwuvQP
F+b/m9JCFVRadU+IHQzkQzqdf+leFq32sOjfw9GDM1HmWS03RdlTMtynjNskng4+
8wOB36iXbvh8fN9Nvg6I9CbAWGcFYrD2Pk0ebAS+Y4qbIsbogWqaDbKoBTcMlhU5
s/WRSNtcYAGuR0Y3llCEVZ9THBt0JulRt0bBJmcCAwEAAaNCMEAwHQYDVR0OBBYE
FERwrA3Ir6AMQahHRPAxoZHM9wEtMB8GA1UdIwQYMBaAFEjNwvQMMQ7Y2lkgpaYj
0gQ2dqdVMA0GCSqGSIb3DQEBCwUAA4IBAQAGZXsXsXDk9BUhDtCFYfXpAWRbW/J7
reBllf78IamhyJ7aXVe+YsOEyuZLQ4FC0FzDUv/ejkrRPXOn6hWqe68xvpLrK5BX
qJ1pwqFnChYg3kYw7eKNwYxx9LBg3QTwMaX28ZnjdqS2OHVlL0YqMa76mZapaV/U
U+sPO/MdeIDvQOWZdNXqMgqXdlS32g/7sX1lrgMz/6afsfY1dcSf9HEjQQwq2ZrY
XAxV3Ev3eikZ68lxeZKXa0HhkerWP83u4P+AcMwNdV481D12KwxWpEKin8icgZj8
UfFxC+e4jlaAnT3I6KWyhAuxyxHmwDyTyXVM46capvbuEEDoS3lqGTzU
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions test/support/certs/key.pem
Original file line number Diff line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MqXjjd93
ATpZRpYP6Eku6SCEbV+kMZEHyMrQ9FC3ZYZN9tKegZxNsxqk6CJrSY3Tux0CR0eu
Ciz3EbUxpQKBgC6zRrqcS5okconMNz0d4IkS3OVyvC7enb3XkuGUB9TxTKJa4xqH
UMegKknDFZ35HfiTt/bicfiHTno4uRWQCr5HdpiN+6PJzyBphF3f8mRZIKAtsqUz
YTZoNl8t6oWq8J7MLD9GikzkApzJ+Fir5mYkVLpBeSiKg4e06QjZvriVAoGAKMDw
XZxag0VvV3tOKkGXQU245j73r5V0KIWx0UKJ038Z9UWGKlf9BcEAtp8+bnoWXng4
GMJkHG5VzPx3OwsciFavbvrmMnSAxWirfeCZS84+P8UtKuVbSBqRgmae2toI/M8B
j2KcMQznIcv618KarLq9Y+COscwB32x51TLF1NUCgYAQ/r3DXGe+WXQSCehjl5cz
wn+WF2CJtFFYX6OpIlZq77Idh9k2zMos7IlX1GhkxaLhvuHn96CZZ644BD1/e4LR
BmK9mHQG45lVVXBr7RGOuE+sGWbD+pQeePdKg7xptX9GzKLhv/T1lnDd7Bub3RDt
O63335zNxLX/Xzwt2Z/6dg==
-----END PRIVATE KEY-----
2 changes: 1 addition & 1 deletion test/thrift/binary/framed/server_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ defmodule Servers.Binary.Framed.IntegrationTest do
end

thrift_test "it can handle bogus data", ctx do
{:ok, socket} = :gen_tcp.connect('localhost', ctx.port, [:binary, packet: 4, active: false])
{:ok, socket} = :gen_tcp.connect(~c"localhost", ctx.port, [:binary, packet: 4, active: false])
:ok = :gen_tcp.send(socket, <<1, 2, 3, 4, 5>>)

assert {:error, :closed} == :gen_tcp.recv(socket, 0)
Expand Down
5 changes: 2 additions & 3 deletions test/thrift/binary/framed/ssl_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,11 @@ defmodule Servers.Binary.Framed.SSLTest do
## Helpers

defp get_certs() do
certs_path = Application.app_dir(:ssl, "examples/certs/etc/server")
cacerts = Path.join(certs_path, "cacerts.pem")
certs_path = Path.join([__DIR__, "..", "..", "..", "support", "certs"]) |> Path.expand()
cert = Path.join(certs_path, "cert.pem")
key = Path.join(certs_path, "key.pem")

{:ok, [cacertfile: cacerts, certfile: cert, keyfile: key]}
{:ok, [certfile: cert, keyfile: key]}
end

def test_configure() do
Expand Down
Loading
Loading