From 9c7178286116d61a565fcba61ec64b20fec3a28a Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sun, 11 Dec 2022 23:50:31 +0000 Subject: [PATCH] Test removed HTTP adapter --- docs/docs/development/API/admin_api.md | 2 +- lib/pleroma/config/deprecation_warnings.ex | 1 + .../20221211234352_remove_unused_indices.exs | 11 +++++++++++ test/pleroma/config/deprecation_warnings_test.exs | 4 +++- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 priv/repo/migrations/20221211234352_remove_unused_indices.exs diff --git a/docs/docs/development/API/admin_api.md b/docs/docs/development/API/admin_api.md index 211b5e736..79cb573ac 100644 --- a/docs/docs/development/API/admin_api.md +++ b/docs/docs/development/API/admin_api.md @@ -1056,7 +1056,7 @@ Most of the settings will be applied in `runtime`, this means that you don't nee Example of setting without keyword in value: ```elixir -config :tesla, :adapter, Tesla.Adapter.Hackney +config :tesla, :adapter, {Tesla.Adapter.Finch, name: MyFinch} ``` List of settings which support only full update by key: diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index 972d1fb96..076b4cbf0 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -213,6 +213,7 @@ defmodule Pleroma.Config.DeprecationWarnings do def check_http_adapter do http_adapter = Application.get_env(:tesla, :adapter) + case http_adapter do {Tesla.Adapter.Finch, _} -> :ok diff --git a/priv/repo/migrations/20221211234352_remove_unused_indices.exs b/priv/repo/migrations/20221211234352_remove_unused_indices.exs new file mode 100644 index 000000000..facc85a26 --- /dev/null +++ b/priv/repo/migrations/20221211234352_remove_unused_indices.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.RemoveUnusedIndices do + use Ecto.Migration + + def change do + drop_if_exists( + index(:activities, ["(data->>'actor')", "inserted_at desc"], name: :activities_actor_index) + ) + + drop_if_exists(index(:objects, ["(data->'tag')"], using: :gin, name: :objects_tags)) + end +end diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index a56601896..b18267a7f 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -281,10 +281,12 @@ defmodule Pleroma.Config.DeprecationWarningsTest do end test "check_http_adapter/0" do - clear_config([:tesla, :adapter], Gun) + Application.put_env(:tesla, :adapter, Gun) assert capture_log(fn -> DeprecationWarnings.check_http_adapter() end) =~ "Your config is using a custom tesla adapter" + + Application.put_env(:tesla, :adapter, Tesla.Mock) end end -- 2.45.2