commit: 344c798b4cb2a7cb65337a81d8b5a2eb27dd1be3
parent 56618873af1aa08f6c271b6cd0f0cbcdfd56bcf1
Author: feld <feld@feld.me>
Date: Wed, 20 Dec 2023 23:26:59 +0000
Merge branch 'fix-otp-comparison' into 'develop'
Fix invalid string comparison for OTP versions and replace with config
See merge request pleroma/pleroma!4013
Diffstat:
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/changelog.d/fix-otp-comparison.skip b/changelog.d/fix-otp-comparison.skip
diff --git a/config/test.exs b/config/test.exs
@@ -153,6 +153,15 @@ config :pleroma, Pleroma.Upload, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.ScheduledActivity, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.Web.RichMedia.Helpers, config_impl: Pleroma.StaticStubbedConfigMock
+peer_module =
+ if String.to_integer(System.otp_release()) >= 25 do
+ :peer
+ else
+ :slave
+ end
+
+config :pleroma, Pleroma.Cluster, peer_module: peer_module
+
if File.exists?("./config/test.secret.exs") do
import_config "test.secret.exs"
else
diff --git a/test/support/cluster.ex b/test/support/cluster.ex
@@ -223,17 +223,13 @@ defmodule Pleroma.Cluster do
|> String.to_atom()
end
- if System.otp_release() >= "25" do
- @peer :peer
- else
- @peer :slave
- end
-
defp do_start_slave(%{host: host, name: name, args: args} = opts) do
- if System.otp_release() >= "25" do
- @peer.start(opts)
+ peer_module = Application.get_env(__MODULE__, :peer_module)
+
+ if peer_module == :peer do
+ peer_module.start(opts)
else
- @peer.start(host, name, args)
+ peer_module.start(host, name, args)
end
end
end