From 99d12c3d4d9559e59c4194f1ba9b99cc2400c489 Mon Sep 17 00:00:00 2001 From: mae <26093674+MaeIsBad@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:55:09 +0100 Subject: [PATCH 1/7] Update MSEV to 1.16 --- .github/workflows/cd.yml | 4 ++-- .github/workflows/ci.yml | 4 ++-- .github/workflows/retire.yml | 4 ++-- .tool-versions | 4 ++-- Dockerfile | 2 +- mix.exs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a25d48d..19d5ec2 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,8 +11,8 @@ jobs: - name: Setup Elixir uses: erlef/setup-beam@v1 with: - otp-version: "25" - elixir-version: "1.14" + otp-version: "26" + elixir-version: "1.16" - name: Checkout uses: actions/checkout@v3 - name: setup hex diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e05ec17..2545b0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: steps: - uses: erlef/setup-beam@v1 with: - elixir-version: 1.14 - otp-version: 25 + elixir-version: 1.16 + otp-version: 26 # Check out the code. - name: Checkout diff --git a/.github/workflows/retire.yml b/.github/workflows/retire.yml index e6e650c..5b49261 100644 --- a/.github/workflows/retire.yml +++ b/.github/workflows/retire.yml @@ -34,8 +34,8 @@ jobs: - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: - otp-version: "25" - elixir-version: "1.14" + otp-version: "26" + elixir-version: "1.16" - run: echo "Attempting to retire version $VERSION" - run: mix hex.config api_key "$HEX_AUTH_KEY" env: diff --git a/.tool-versions b/.tool-versions index bde48fc..b0a91d7 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -erlang 25.3.2.8 -elixir 1.14.5-otp-25 +erlang 26.2.5.3 +elixir 1.16.3-otp-26 diff --git a/Dockerfile b/Dockerfile index 4d1eeb6..08fa4f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/prima/elixir:1.14.2-5 +FROM public.ecr.aws/prima/elixir:1.16.3 WORKDIR /code diff --git a/mix.exs b/mix.exs index 20e41fe..bf70025 100644 --- a/mix.exs +++ b/mix.exs @@ -6,7 +6,7 @@ defmodule Amqpx.MixProject do app: :amqpx, name: "amqpx", version: "6.1.2", - elixir: "~> 1.14", + elixir: "~> 1.16", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :production, deps: deps(), From 9ce470b7689c3aaf0228242cb6ef2e12fe3c4687 Mon Sep 17 00:00:00 2001 From: mae <26093674+MaeIsBad@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:55:13 +0100 Subject: [PATCH 2/7] Update rabbit libraries to 4.0 --- mix.exs | 4 ++-- mix.lock | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mix.exs b/mix.exs index bf70025..05f29fe 100644 --- a/mix.exs +++ b/mix.exs @@ -51,8 +51,8 @@ defmodule Amqpx.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:amqp_client, "~> 3.9"}, - {:rabbit_common, "~> 3.9"}, + {:amqp_client, "~> 4.0"}, + {:rabbit_common, "~> 4.0"}, {:elixir_uuid, "~> 1.2"}, {:credo, "~> 1.5", only: [:dev, :test, :gha]}, {:mock, "~> 0.3.7", only: [:test, :gha]}, diff --git a/mix.lock b/mix.lock index 4ce9d38..8fcf3fa 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,5 @@ %{ - "amqp_client": {:hex, :amqp_client, "3.12.14", "2b677bc3f2e2234ba7517042b25d72071a79735042e91f9116bd3c176854b622", [:make, :rebar3], [{:credentials_obfuscation, "3.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:rabbit_common, "3.12.14", [hex: :rabbit_common, repo: "hexpm", optional: false]}], "hexpm", "5f70b6c3b1a739790080da4fddc94a867e99f033c4b1edc20d6ff8b8fb4bd160"}, + "amqp_client": {:hex, :amqp_client, "4.0.3", "c7dcc8031c780cd39ec586ba827a8eb26e006e9761af8d3f58fded11f645ebd4", [:make, :rebar3], [{:credentials_obfuscation, "3.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:rabbit_common, "4.0.3", [hex: :rabbit_common, repo: "hexpm", optional: false]}], "hexpm", "ae945f7280617e9a4b17a6d49e3a2f496d716e8088ec29d8e94ecc79e5da7458"}, "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "credentials_obfuscation": {:hex, :credentials_obfuscation, "3.4.0", "34e18b126b3aefd6e8143776fbe1ceceea6792307c99ac5ee8687911f048cfd7", [:rebar3], [], "hexpm", "738ace0ed5545d2710d3f7383906fc6f6b582d019036e5269c4dbd85dbced566"}, "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"}, @@ -16,7 +16,8 @@ "meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"}, "mock": {:hex, :mock, "0.3.9", "10e44ad1f5962480c5c9b9fa779c6c63de9bd31997c8e04a853ec990a9d841af", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "9e1b244c4ca2551bb17bb8415eed89e40ee1308e0fbaed0a4fdfe3ec8a4adbd3"}, "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, - "rabbit_common": {:hex, :rabbit_common, "3.12.14", "466123ee7346a3cdac078c0c302bcd36da4523e8acd678c1b992f7b4df1f7914", [:make, :rebar3], [{:credentials_obfuscation, "3.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:recon, "2.5.3", [hex: :recon, repo: "hexpm", optional: false]}, {:thoas, "1.0.0", [hex: :thoas, repo: "hexpm", optional: false]}], "hexpm", "70c31a51f7401cc0204ddef2745d98680c2e0df67e3b0c9e198916881fde3293"}, - "recon": {:hex, :recon, "2.5.3", "739107b9050ea683c30e96de050bc59248fd27ec147696f79a8797ff9fa17153", [:mix, :rebar3], [], "hexpm", "6c6683f46fd4a1dfd98404b9f78dcabc7fcd8826613a89dcb984727a8c3099d7"}, - "thoas": {:hex, :thoas, "1.0.0", "567c03902920827a18a89f05b79a37b5bf93553154b883e0131801600cf02ce0", [:rebar3], [], "hexpm", "fc763185b932ecb32a554fb735ee03c3b6b1b31366077a2427d2a97f3bd26735"}, + "rabbit_common": {:hex, :rabbit_common, "4.0.3", "e927b882733d122f6802662220bdb1a83774852dbe67d21d4e33aaf54f3998dd", [:make, :rebar3], [{:credentials_obfuscation, "3.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:ranch, "2.1.0", [hex: :ranch, repo: "hexpm", optional: false]}, {:recon, "2.5.6", [hex: :recon, repo: "hexpm", optional: false]}, {:thoas, "1.2.1", [hex: :thoas, repo: "hexpm", optional: false]}], "hexpm", "ead31ba292c2cc5fda48a486417d7cfe8966f661994d7ed6c3e5f8840828e8ec"}, + "ranch": {:hex, :ranch, "2.1.0", "2261f9ed9574dcfcc444106b9f6da155e6e540b2f82ba3d42b339b93673b72a3", [:make, :rebar3], [], "hexpm", "244ee3fa2a6175270d8e1fc59024fd9dbc76294a321057de8f803b1479e76916"}, + "recon": {:hex, :recon, "2.5.6", "9052588e83bfedfd9b72e1034532aee2a5369d9d9343b61aeb7fbce761010741", [:mix, :rebar3], [], "hexpm", "96c6799792d735cc0f0fd0f86267e9d351e63339cbe03df9d162010cefc26bb0"}, + "thoas": {:hex, :thoas, "1.2.1", "19a25f31177a17e74004d4840f66d791d4298c5738790fa2cc73731eb911f195", [:rebar3], [], "hexpm", "e38697edffd6e91bd12cea41b155115282630075c2a727e7a6b2947f5408b86a"}, } From 9e5bab3b982d30d7d8648a7d7bef91329c30bfac Mon Sep 17 00:00:00 2001 From: mae <26093674+MaeIsBad@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:03:05 +0100 Subject: [PATCH 3/7] Update changelog --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c44a438..31520f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,17 @@ and this project adheres to ## [Unreleased] +### Updated + +- rabbit libraries to `amqp_client` and `rabbit_common` to 4.0 + +- Increased minimum supported elixir version to 1.16, otp 26 + +This is due to elixir rabbit not supporting + --- -## [6.1.2] - 2024-12-02 +## [6.1.2] - 2024-12-02:q ### Added From 07725d8e5fbfe005402060076ad5ed5cd98ce8e8 Mon Sep 17 00:00:00 2001 From: mae <26093674+MaeIsBad@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:26:26 +0100 Subject: [PATCH 4/7] Linters --- lib/amqp/gen/connection_manager.ex | 2 +- lib/amqp/gen/consumer.ex | 2 +- lib/amqp/gen/producer.ex | 2 +- lib/amqp/helper.ex | 2 +- test/connection_test.exs | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/amqp/gen/connection_manager.ex b/lib/amqp/gen/connection_manager.ex index 47579ae..91c7096 100644 --- a/lib/amqp/gen/connection_manager.ex +++ b/lib/amqp/gen/connection_manager.ex @@ -56,7 +56,7 @@ defmodule Amqpx.Gen.ConnectionManager do end def handle_info(message, state) do - Logger.warn("Unknown message received #{inspect(message)}") + Logger.warning("Unknown message received #{inspect(message)}") {:noreply, state} end diff --git a/lib/amqp/gen/consumer.ex b/lib/amqp/gen/consumer.ex index 4b9a234..b06e4a6 100644 --- a/lib/amqp/gen/consumer.ex +++ b/lib/amqp/gen/consumer.ex @@ -182,7 +182,7 @@ defmodule Amqpx.Gen.Consumer do def handle_info({:EXIT, _, :normal}, state), do: {:noreply, state} def handle_info(message, state) do - Logger.warn("Unknown message received #{inspect(message)}") + Logger.warning("Unknown message received #{inspect(message)}") {:noreply, state} end diff --git a/lib/amqp/gen/producer.ex b/lib/amqp/gen/producer.ex index 2931e65..12df3c6 100644 --- a/lib/amqp/gen/producer.ex +++ b/lib/amqp/gen/producer.ex @@ -129,7 +129,7 @@ defmodule Amqpx.Gen.Producer do def handle_info({:EXIT, _, :normal}, state), do: {:noreply, state} def handle_info(message, state) do - Logger.warn("Unknown message received #{inspect(message)}") + Logger.warning("Unknown message received #{inspect(message)}") {:noreply, state} end diff --git a/lib/amqp/helper.ex b/lib/amqp/helper.ex index 1dcbc40..df16ba4 100644 --- a/lib/amqp/helper.ex +++ b/lib/amqp/helper.ex @@ -98,7 +98,7 @@ defmodule Amqpx.Helper do "If x-dead-letter-exchange is an empty string, x-dead-letter-routing-key should be '#{dlq}' instead of '#{bad_dlq}'" if Enum.member?(skip_dead_letter_routing_key_check_for(), bad_dlq) do - Logger.warn(msg) + Logger.warning(msg) else raise msg end diff --git a/test/connection_test.exs b/test/connection_test.exs index d251a47..d1dd532 100644 --- a/test/connection_test.exs +++ b/test/connection_test.exs @@ -8,8 +8,8 @@ defmodule ConnectionTest do @obfuscate_password false - @invalid_ip '192.168.1.1' - @valid_ip '192.168.1.2' + @invalid_ip ~c"192.168.1.1" + @valid_ip ~c"192.168.1.2" @open_options [ username: "amqpx", From 8570e5c7c36781b6592aeb466c4c5af678393bbe Mon Sep 17 00:00:00 2001 From: mae <26093674+MaeIsBad@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:36:43 +0100 Subject: [PATCH 5/7] Correct typespec --- lib/amqp/gen/producer.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/amqp/gen/producer.ex b/lib/amqp/gen/producer.ex index 12df3c6..4b2975f 100644 --- a/lib/amqp/gen/producer.ex +++ b/lib/amqp/gen/producer.ex @@ -31,7 +31,7 @@ defmodule Amqpx.Gen.Producer do # Public API - @spec start_link(opts :: map()) :: GenServer.server() + @spec start_link(opts :: map()) :: GenServer.on_start() def start_link(opts) do gen_server_opts = opts From 3c065a031b1155c7e763f623e8c1c34f7d93a9b1 Mon Sep 17 00:00:00 2001 From: mae <26093674+MaeIsBad@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:36:49 +0100 Subject: [PATCH 6/7] fix tests --- test/gen_test.exs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/gen_test.exs b/test/gen_test.exs index 8043e4b..5eafa79 100644 --- a/test/gen_test.exs +++ b/test/gen_test.exs @@ -451,6 +451,8 @@ defmodule Amqpx.Test.AmqpxTest do describe "configuration validation" do test "if retry_policy is configured, max_retries must be > 0" do + Process.flag(:trap_exit, true) + assert {:error, {:invalid_configuration, "when retry policy is configured, max_retries must be > 0"}} = Amqpx.Gen.Producer.start_link(%{ name: :producer_misconfigured_retry_policy_max_retries, @@ -471,6 +473,8 @@ defmodule Amqpx.Test.AmqpxTest do end test "if retry_policy is configured, max_retries must be set" do + Process.flag(:trap_exit, true) + assert {:error, {:invalid_configuration, "when retry policy is configured, max_retries must be > 0"}} = Amqpx.Gen.Producer.start_link(%{ name: :producer_misconfigured_retry_policy_max_retries, From 1a8c1f040e251e19c56f212d1d6ceff32377aab1 Mon Sep 17 00:00:00 2001 From: mae <26093674+MaeIsBad@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:15:11 +0100 Subject: [PATCH 7/7] fixup! Update changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31520f3..b6e29b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,11 @@ and this project adheres to - Increased minimum supported elixir version to 1.16, otp 26 -This is due to elixir rabbit not supporting +This is due to elixir rabbit not supporting the older versions of the libraries --- -## [6.1.2] - 2024-12-02:q +## [6.1.2] - 2024-12-02 ### Added