QdrantSearch: Add healthcheck for qdrant
This commit is contained in:
parent
08e9d995f8
commit
8b76f56050
|
@ -139,6 +139,17 @@ def search(_user, query, options) do
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
defmodule Pleroma.Search.QdrantSearch.OpenAIClient do
|
defmodule Pleroma.Search.QdrantSearch.OpenAIClient do
|
||||||
|
|
|
@ -15,6 +15,18 @@ defmodule Pleroma.Search.QdrantSearchTest do
|
||||||
alias Pleroma.Workers.SearchIndexingWorker
|
alias Pleroma.Workers.SearchIndexingWorker
|
||||||
|
|
||||||
describe "Qdrant search" do
|
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
|
test "searches for a term by encoding it and sending it to qdrant" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue