summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLain Soykaf <lain@lain.com>2024-05-27 13:57:42 +0400
committerLain Soykaf <lain@lain.com>2024-05-27 14:01:17 +0400
commit8b76f56050a609bf562053cb7201a9204901490e (patch)
treea4c9c7244e45767eee0d04b0e801c9869114318f
parent08e9d995f884f351d96c161e6c73cc668cc5bcd8 (diff)
downloadpleroma-8b76f56050a609bf562053cb7201a9204901490e.tar.gz
pleroma-8b76f56050a609bf562053cb7201a9204901490e.zip
QdrantSearch: Add healthcheck for qdrant
-rw-r--r--lib/pleroma/search/qdrant_search.ex11
-rw-r--r--test/pleroma/search/qdrant_search_test.exs12
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/pleroma/search/qdrant_search.ex b/lib/pleroma/search/qdrant_search.ex
index 19e8cd4bf..3c3ffce16 100644
--- a/lib/pleroma/search/qdrant_search.ex
+++ b/lib/pleroma/search/qdrant_search.ex
@@ -139,6 +139,17 @@ defmodule Pleroma.Search.QdrantSearch do
[]
end
end
+
+ @impl true
+ def healthcheck_endpoints do
+ qdrant_health =
+ Config.get([Pleroma.Search.QdrantSearch, :qdrant_url])
+ |> URI.parse()
+ |> Map.put(:path, "/healthz")
+ |> URI.to_string()
+
+ [qdrant_health]
+ end
end
defmodule Pleroma.Search.QdrantSearch.OpenAIClient do
diff --git a/test/pleroma/search/qdrant_search_test.exs b/test/pleroma/search/qdrant_search_test.exs
index 46485392e..b389aa816 100644
--- a/test/pleroma/search/qdrant_search_test.exs
+++ b/test/pleroma/search/qdrant_search_test.exs
@@ -15,6 +15,18 @@ defmodule Pleroma.Search.QdrantSearchTest do
alias Pleroma.Workers.SearchIndexingWorker
describe "Qdrant search" do
+ test "returns the correct healthcheck endpoints" do
+ Config
+ |> expect(:get, 1, fn
+ [Pleroma.Search.QdrantSearch, key], nil ->
+ %{qdrant_url: "https://qdrant.url"}[key]
+ end)
+
+ health_endpoints = QdrantSearch.healthcheck_endpoints()
+
+ assert "https://qdrant.url/healthz" in health_endpoints
+ end
+
test "searches for a term by encoding it and sending it to qdrant" do
user = insert(:user)