From 37a31e06bb33aaff1e9263672285dcec82b879b2 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Sun, 26 Nov 2023 23:29:24 -0500 Subject: [PATCH] Update minimum Elixir to 12, update ci and tool-versions (#335) * Update minimum Elixir to 12, update ci and tool-versions * chore: dialyzer and format! * chore: make some tests pass * test: make tests pass * fix: remove statix/statsd --------- Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com> --- .github/workflows/ci.yml | 46 ++++++++++++------- .tool-versions | 4 +- benchmark/config/prod.exs | 2 +- examples/helloworld/config/prod.exs | 2 +- interop/config/config.exs | 2 +- interop/lib/interop/app.ex | 2 - interop/lib/interop/endpoint.ex | 2 - interop/lib/interop/stats_interceptor.ex | 7 --- interop/mix.exs | 5 +- interop/mix.lock | 13 ++---- interop/script/run.exs | 4 +- lib/grpc/client/interceptors/logger.ex | 2 +- lib/grpc/server/supervisor.ex | 3 +- mix.exs | 6 +-- mix.lock | 4 +- .../adapters/mint/connection_process_test.exs | 4 +- test/grpc/client/interceptors/logger_test.exs | 4 +- test/grpc/integration/server_test.exs | 2 +- test/grpc/server/adapters/cowboy_test.exs | 17 ++++--- test/grpc/server/interceptors/logger_test.exs | 4 +- test/support/factory.ex | 2 +- 21 files changed, 68 insertions(+), 69 deletions(-) delete mode 100644 interop/lib/interop/stats_interceptor.ex diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e06f405a..be0b5243 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v3 - uses: erlef/setup-beam@v1 with: - otp-version: 25.1.x + otp-version: 26.1.x elixir-version: 1.14.x - name: Retrieve dependencies cache uses: actions/cache@v3 @@ -33,15 +33,21 @@ jobs: name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} strategy: matrix: - otp: [22.x, 23.x, 24.x, 25.1.x] - elixir: [1.11.x, 1.12.x, 1.13.x, 1.14.x] + otp: [23.x, 24.x, 25.1.x, 26.1.x] + elixir: [1.12.x, 1.13.x, 1.14.x, 1.15.x] exclude: - otp: 25.1.x - elixir: 1.11.x - - otp: 25.1.x elixir: 1.12.x - - otp: 22.x + - otp: 26.1.x + elixir: 1.12.x + - otp: 25.1.x + elixir: 1.13.x + - otp: 26.1.x + elixir: 1.13.x + - otp: 26.1.x elixir: 1.14.x + - otp: 23.x + elixir: 1.15.x needs: check_format steps: - uses: actions/checkout@v3 @@ -68,8 +74,8 @@ jobs: - uses: actions/checkout@v3 - uses: erlef/setup-beam@v1 with: - otp-version: 25.1.x - elixir-version: 1.14.x + otp-version: 26.1.x + elixir-version: 1.15.x - name: Retrieve dependencies cache uses: actions/cache@v3 id: mix-cache # id to use in retrieve action @@ -90,15 +96,21 @@ jobs: if: ${{ github.ref == 'refs/heads/master' }} strategy: matrix: - otp: [22.x, 23.x, 24.x, 25.1.x] - elixir: [1.11.x, 1.12.x, 1.13.x, 1.14.x] + otp: [23.x, 24.x, 25.1.x, 26.1.x] + elixir: [1.12.x, 1.13.x, 1.14.x, 1.15.x] exclude: - otp: 25.1.x - elixir: 1.11.x - - otp: 25.1.x elixir: 1.12.x - - otp: 22.x + - otp: 26.1.x + elixir: 1.12.x + - otp: 25.1.x + elixir: 1.13.x + - otp: 26.1.x + elixir: 1.13.x + - otp: 26.1.x elixir: 1.14.x + - otp: 23.x + elixir: 1.15.x steps: - uses: actions/checkout@v3 - uses: erlef/setup-beam@v1 @@ -123,8 +135,8 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - otp: [24.x, 25.1.x] - elixir: [1.14.x] + otp: [25.1.x, 26.1.x] + elixir: [1.15.x] env: MIX_ENV: test steps: @@ -157,8 +169,8 @@ jobs: - uses: actions/checkout@v3 - uses: erlef/setup-beam@v1 with: - otp-version: 25.1.x - elixir-version: 1.14.x + otp-version: 26.1.x + elixir-version: 1.15.x - name: Retrieve dependencies cache uses: actions/cache@v3 id: mix-cache # id to use in retrieve action diff --git a/.tool-versions b/.tool-versions index b4e85141..510eaf42 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -elixir 1.14.2-otp-25 -erlang 25.1.1 +elixir 1.15.7-otp-26 +erlang 26.1.2 diff --git a/benchmark/config/prod.exs b/benchmark/config/prod.exs index 3da7d10f..63787d4b 100644 --- a/benchmark/config/prod.exs +++ b/benchmark/config/prod.exs @@ -1,3 +1,3 @@ import Config -config :logger, level: :warn +config :logger, level: :warning diff --git a/examples/helloworld/config/prod.exs b/examples/helloworld/config/prod.exs index 2dd33c31..2c946e80 100644 --- a/examples/helloworld/config/prod.exs +++ b/examples/helloworld/config/prod.exs @@ -1,4 +1,4 @@ import Config config :logger, - level: :warn + level: :warning diff --git a/interop/config/config.exs b/interop/config/config.exs index 3da7d10f..63787d4b 100644 --- a/interop/config/config.exs +++ b/interop/config/config.exs @@ -1,3 +1,3 @@ import Config -config :logger, level: :warn +config :logger, level: :warning diff --git a/interop/lib/interop/app.ex b/interop/lib/interop/app.ex index 34d13c2d..1981f7c8 100644 --- a/interop/lib/interop/app.ex +++ b/interop/lib/interop/app.ex @@ -4,8 +4,6 @@ defmodule Interop.App do def start(_type, _args) do children = [{GRPC.Server.Supervisor, endpoint: Interop.Endpoint, port: 10000}] - Interop.ServerInterceptor.Statix.connect() - opts = [strategy: :one_for_one, name: __MODULE__] Supervisor.start_link(children, opts) end diff --git a/interop/lib/interop/endpoint.ex b/interop/lib/interop/endpoint.ex index 87fa066d..f58cc9b8 100644 --- a/interop/lib/interop/endpoint.ex +++ b/interop/lib/interop/endpoint.ex @@ -1,7 +1,5 @@ defmodule Interop.Endpoint do use GRPC.Endpoint - intercept Interop.ServerInterceptor - run Interop.Server end diff --git a/interop/lib/interop/stats_interceptor.ex b/interop/lib/interop/stats_interceptor.ex deleted file mode 100644 index 9813f54b..00000000 --- a/interop/lib/interop/stats_interceptor.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule Interop.ServerInterceptor.Statix do - use Statix -end - -defmodule Interop.ServerInterceptor do - use GRPCStatsd.ServerInterceptor, statsd_module: Interop.ServerInterceptor.Statix -end diff --git a/interop/mix.exs b/interop/mix.exs index 98a0cf21..0b432a91 100644 --- a/interop/mix.exs +++ b/interop/mix.exs @@ -23,10 +23,7 @@ defmodule Interop.MixProject do defp deps do [ {:grpc, path: "..", override: true}, - {:protobuf, "~> 0.11"}, - {:grpc_statsd, "~> 0.1.0"}, - {:statix, ">= 1.2.1"}, - {:extrace, "~> 0.2"}, + {:protobuf, "~> 0.11"} ] end end diff --git a/interop/mix.lock b/interop/mix.lock index 8a9b594c..e24af57b 100644 --- a/interop/mix.lock +++ b/interop/mix.lock @@ -1,14 +1,11 @@ %{ - "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, - "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, - "extrace": {:hex, :extrace, "0.2.1", "e234f1f64df8c989771b7b5d047a3412f10512c0e3d414fc7eb0e8fc633779f8", [:mix], [{:recon, "~> 2.5", [hex: :recon, repo: "hexpm", optional: false]}], "hexpm", "1b2d9fc4bacc208d5aaa97f61e7c47b66ff4dfc155e9b95647e68ca316ab3981"}, + "cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"}, + "cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"}, "grpc": {:git, "https://github.com/elixir-grpc/grpc.git", "21422839798e49bf6d29327fab0a7add51becedd", []}, - "grpc_statsd": {:hex, :grpc_statsd, "0.1.0", "a95ae388188486043f92a3c5091c143f5a646d6af80c9da5ee616546c4d8f5ff", [:mix], [{:grpc, ">= 0.0.0", [hex: :grpc, repo: "hexpm", optional: true]}, {:statix, ">= 0.0.0", [hex: :statix, repo: "hexpm", optional: true]}], "hexpm", "de0c05db313c7b3ffeff345855d173fd82fec3de16591a126b673f7f698d9e74"}, - "gun": {:hex, :grpc_gun, "2.0.1", "221b792df3a93e8fead96f697cbaf920120deacced85c6cd3329d2e67f0871f8", [:rebar3], [{:cowlib, "~> 2.11", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "795a65eb9d0ba16697e6b0e1886009ce024799e43bb42753f0c59b029f592831"}, + "gun": {:hex, :gun, "2.0.1", "160a9a5394800fcba41bc7e6d421295cf9a7894c2252c0678244948e3336ad73", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "a10bc8d6096b9502205022334f719cc9a08d9adcfbfc0dbee9ef31b56274a20b"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, - "mint": {:hex, :mint, "1.4.2", "50330223429a6e1260b2ca5415f69b0ab086141bc76dc2fbf34d7c389a6675b2", [:mix], [{:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "ce75a5bbcc59b4d7d8d70f8b2fc284b1751ffb35c7b6a6302b5192f8ab4ddd80"}, + "mint": {:hex, :mint, "1.5.1", "8db5239e56738552d85af398798c80648db0e90f343c8469f6c6d8898944fb6f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4a63e1e76a7c3956abd2c72f370a0d0aecddc3976dea5c27eccbecfa5e7d5b1e"}, "protobuf": {:hex, :protobuf, "0.11.0", "58d5531abadea3f71135e97bd214da53b21adcdb5b1420aee63f4be8173ec927", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "30ad9a867a5c5a0616cac9765c4d2c2b7b0030fa81ea6d0c14c2eb5affb6ac52"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, - "recon": {:hex, :recon, "2.5.0", "2f7fcbec2c35034bade2f9717f77059dc54eb4e929a3049ca7ba6775c0bd66cd", [:mix, :rebar3], [], "hexpm", "72f3840fedd94f06315c523f6cecf5b4827233bed7ae3fe135b2a0ebeab5e196"}, - "statix": {:hex, :statix, "1.2.1", "4f23c8cc2477ea0de89fed5e34f08c54b0d28b838f7b8f26613155f2221bb31e", [:mix], [], "hexpm", "7f988988fddcce19ae376bb8e47aa5ea5dabf8d4ba78d34d1ae61eb537daf72e"}, + "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, } diff --git a/interop/script/run.exs b/interop/script/run.exs index 49197ddb..554d641b 100644 --- a/interop/script/run.exs +++ b/interop/script/run.exs @@ -1,9 +1,9 @@ -{options, _, _} = OptionParser.parse(System.argv(), strict: [rounds: :integer, concurrency: :integer, port: :integer]) +{options, _, _} = OptionParser.parse(System.argv(), strict: [rounds: :integer, concurrency: :integer, port: :integer, level: :string]) rounds = Keyword.get(options, :rounds) || 20 max_concurrency = System.schedulers_online() concurrency = Keyword.get(options, :concurrency) || max_concurrency port = Keyword.get(options, :port) || 0 -level = Keyword.get(options, :log_level) || "warn" +level = Keyword.get(options, :level) || "warning" level = String.to_existing_atom(level) require Logger diff --git a/lib/grpc/client/interceptors/logger.ex b/lib/grpc/client/interceptors/logger.ex index 5a61e514..12ad5e2b 100644 --- a/lib/grpc/client/interceptors/logger.ex +++ b/lib/grpc/client/interceptors/logger.ex @@ -15,7 +15,7 @@ defmodule GRPC.Client.Interceptors.Logger do ## Usage with custom level - {:ok, channel} = GRPC.Stub.connect("localhost:50051", interceptors: [{GRPC.Client.Interceptors.Logger, level: :warn}]) + {:ok, channel} = GRPC.Stub.connect("localhost:50051", interceptors: [{GRPC.Client.Interceptors.Logger, level: :warning}]) """ require Logger diff --git a/lib/grpc/server/supervisor.ex b/lib/grpc/server/supervisor.ex index 69bcbd02..5d83e36e 100644 --- a/lib/grpc/server/supervisor.ex +++ b/lib/grpc/server/supervisor.ex @@ -24,7 +24,8 @@ defmodule GRPC.Server.Supervisor do @type sup_flags() :: %{ strategy: Supervisor.strategy(), intensity: non_neg_integer(), - period: pos_integer() + period: pos_integer(), + auto_shutdown: Supervisor.auto_shutdown() } @default_adapter GRPC.Server.Adapters.Cowboy diff --git a/mix.exs b/mix.exs index eddc1931..bddeaa41 100644 --- a/mix.exs +++ b/mix.exs @@ -7,7 +7,7 @@ defmodule GRPC.Mixfile do [ app: :grpc, version: @version, - elixir: "~> 1.11", + elixir: "~> 1.12", elixirc_paths: elixirc_paths(Mix.env()), build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, @@ -21,7 +21,7 @@ defmodule GRPC.Mixfile do source_url: "https://github.com/elixir-grpc/grpc" ], dialyzer: [ - plt_add_deps: :apps_tree, + plt_add_deps: :app_tree, plt_add_apps: [:iex, :mix, :ex_unit], list_unused_filters: true, plt_file: {:no_warn, "_build/#{Mix.env()}/plts/dialyzer.plt"} @@ -45,7 +45,7 @@ defmodule GRPC.Mixfile do {:cowlib, "~> 2.12"}, {:protobuf, "~> 0.11", only: [:dev, :test]}, {:ex_doc, "~> 0.29", only: :dev}, - {:dialyxir, "~> 1.1.0", only: [:dev, :test], runtime: false}, + {:dialyxir, "~> 1.4.0", only: [:dev, :test], runtime: false}, {:ex_parameterized, "~> 1.3.7", only: :test}, {:telemetry, "~> 1.0"} ] diff --git a/mix.lock b/mix.lock index 53e65703..83eee06c 100644 --- a/mix.lock +++ b/mix.lock @@ -1,15 +1,13 @@ %{ - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"}, "cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"}, - "dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"}, + "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, "earmark_parser": {:hex, :earmark_parser, "1.4.32", "fa739a0ecfa34493de19426681b23f6814573faee95dfd4b4aafe15a7b5b32c6", [:mix], [], "hexpm", "b8b0dd77d60373e77a3d7e8afa598f325e49e8663a51bcc2b88ef41838cca755"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_doc": {:hex, :ex_doc, "0.29.4", "6257ecbb20c7396b1fe5accd55b7b0d23f44b6aa18017b415cb4c2b91d997729", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2c6699a737ae46cb61e4ed012af931b57b699643b24dabe2400a8168414bc4f5"}, "ex_parameterized": {:hex, :ex_parameterized, "1.3.7", "801f85fc4651cb51f11b9835864c6ed8c5e5d79b1253506b5bb5421e8ab2f050", [:mix], [], "hexpm", "1fb0dc4aa9e8c12ae23806d03bcd64a5a0fc9cd3f4c5602ba72561c9b54a625c"}, "gun": {:hex, :gun, "2.0.1", "160a9a5394800fcba41bc7e6d421295cf9a7894c2252c0678244948e3336ad73", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "a10bc8d6096b9502205022334f719cc9a08d9adcfbfc0dbee9ef31b56274a20b"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, - "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, diff --git a/test/grpc/client/adapters/mint/connection_process_test.exs b/test/grpc/client/adapters/mint/connection_process_test.exs index 8989a6ae..361cae73 100644 --- a/test/grpc/client/adapters/mint/connection_process_test.exs +++ b/test/grpc/client/adapters/mint/connection_process_test.exs @@ -16,7 +16,9 @@ defmodule GRPC.Client.Adapters.Mint.ConnectionProcessTest do end describe "start_link/4" do - test "non-successful connection stops the connection process without exit it's caller" do + test "non-successful connection stops the connection process without exiting it's caller" do + Process.flag(:trap_exit, true) + logs = capture_log(fn -> assert {:error, %Mint.TransportError{reason: :econnrefused}} == diff --git a/test/grpc/client/interceptors/logger_test.exs b/test/grpc/client/interceptors/logger_test.exs index e3dbc63d..01021f11 100644 --- a/test/grpc/client/interceptors/logger_test.exs +++ b/test/grpc/client/interceptors/logger_test.exs @@ -40,7 +40,7 @@ defmodule GRPC.Client.Interceptors.LoggerTest do request = %FakeRequest{} stream = %Stream{grpc_type: :unary, rpc: @rpc, service_name: @service_name} next = fn _stream, _request -> {:ok, :ok} end - opts = LoggerInterceptor.init(level: :warn) + opts = LoggerInterceptor.init(level: :warning) logs = capture_log(fn -> @@ -65,7 +65,7 @@ defmodule GRPC.Client.Interceptors.LoggerTest do end test "calls next when below :logger level" do - Logger.configure(level: :warn) + Logger.configure(level: :warning) request = %FakeRequest{} stream = %Stream{grpc_type: :unary, rpc: @rpc, service_name: @service_name} diff --git a/test/grpc/integration/server_test.exs b/test/grpc/integration/server_test.exs index 378a6754..0bcf6aa2 100644 --- a/test/grpc/integration/server_test.exs +++ b/test/grpc/integration/server_test.exs @@ -138,7 +138,7 @@ defmodule GRPC.Integration.ServerTest do {:ok, reply} = channel |> Helloworld.Greeter.Stub.say_hello(req) assert reply.message == "Hello, Elixir" - {:ok, conn_pid} = :gun.open('localhost', port) + {:ok, conn_pid} = :gun.open(~c"localhost", port) stream_ref = :gun.get(conn_pid, "/status") assert_receive {:gun_response, ^conn_pid, ^stream_ref, :nofin, 200, _headers} diff --git a/test/grpc/server/adapters/cowboy_test.exs b/test/grpc/server/adapters/cowboy_test.exs index 2345fce8..3877dafc 100644 --- a/test/grpc/server/adapters/cowboy_test.exs +++ b/test/grpc/server/adapters/cowboy_test.exs @@ -15,7 +15,9 @@ defmodule GRPC.Server.Adapters.CowboyTest do ]) socket_opts = get_socket_opts_from_child_spec(spec) - assert socket_opts == [:inet, {:ipv6_v6only, false}, {:ip, {127, 0, 0, 1}}, {:port, 8080}] + + assert Enum.sort(socket_opts) == + Enum.sort([:inet, {:ip, {127, 0, 0, 1}}, {:ipv6_v6only, false}, {:port, 8080}]) end test "produces the correct socket opts for ranch_tcp for inet6" do @@ -30,12 +32,13 @@ defmodule GRPC.Server.Adapters.CowboyTest do socket_opts = get_socket_opts_from_child_spec(spec) - assert socket_opts == [ - :inet6, - {:ipv6_v6only, true}, - {:ip, {0, 0, 0, 0, 0, 0, 0, 1}}, - {:port, 8081} - ] + assert Enum.sort(socket_opts) == + Enum.sort([ + :inet6, + {:ip, {0, 0, 0, 0, 0, 0, 0, 1}}, + {:ipv6_v6only, true}, + {:port, 8081} + ]) end end diff --git a/test/grpc/server/interceptors/logger_test.exs b/test/grpc/server/interceptors/logger_test.exs index b62b3a8a..a05b23b3 100644 --- a/test/grpc/server/interceptors/logger_test.exs +++ b/test/grpc/server/interceptors/logger_test.exs @@ -68,7 +68,7 @@ defmodule GRPC.Server.Interceptors.LoggerTest do request = %FakeRequest{} stream = %Stream{server: @server_name, rpc: @rpc, request_id: nil} next = fn _stream, _request -> {:ok, :ok} end - opts = LoggerInterceptor.init(level: :warn) + opts = LoggerInterceptor.init(level: :warning) logs = capture_log(fn -> @@ -93,7 +93,7 @@ defmodule GRPC.Server.Interceptors.LoggerTest do end test "calls next when below :logger level" do - Logger.configure(level: :warn) + Logger.configure(level: :warning) request = %FakeRequest{} stream = %Stream{server: @server_name, rpc: @rpc, request_id: nil} diff --git a/test/support/factory.ex b/test/support/factory.ex index ffc11795..99a439f0 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -46,7 +46,7 @@ defmodule GRPC.Factory do cacertfile: ca_path, keyfile: key_path, verify: :verify_none, - versions: [:"tlsv1.2"] + versions: [:"tlsv1.2", :"tlsv1.3"] ] } end