projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
allow disabling prometheus entirely
[akkoma]
/
test
/
pleroma
/
web
/
akkoma_api
/
metrics_controller_test.exs
diff --git
a/test/pleroma/web/akkoma_api/metrics_controller_test.exs
b/test/pleroma/web/akkoma_api/metrics_controller_test.exs
index 4b7214e6f689e61108a1294d8f9fadfe3810e8a9..e703fc36c6f7e50f13a40ea5de4274516ed96f3c 100644
(file)
--- a/
test/pleroma/web/akkoma_api/metrics_controller_test.exs
+++ b/
test/pleroma/web/akkoma_api/metrics_controller_test.exs
@@
-1,9
+1,6
@@
defmodule Pleroma.Web.AkkomaAPI.MetricsControllerTest do
use Pleroma.Web.ConnCase, async: true
defmodule Pleroma.Web.AkkomaAPI.MetricsControllerTest do
use Pleroma.Web.ConnCase, async: true
- import Pleroma.Factory
- alias Pleroma.Akkoma.FrontendSettingsProfile
-
describe "GET /api/v1/akkoma/metrics" do
test "should return metrics when the user has admin:metrics" do
%{conn: conn} = oauth_access(["admin:metrics"])
describe "GET /api/v1/akkoma/metrics" do
test "should return metrics when the user has admin:metrics" do
%{conn: conn} = oauth_access(["admin:metrics"])
@@
-16,9
+13,17
@@
defmodule Pleroma.Web.AkkomaAPI.MetricsControllerTest do
test "should not allow users that do not have the admin:metrics scope" do
%{conn: conn} = oauth_access(["read:metrics"])
test "should not allow users that do not have the admin:metrics scope" do
%{conn: conn} = oauth_access(["read:metrics"])
-
resp =
conn
+ conn
|> get("/api/v1/akkoma/metrics")
|> json_response(403)
end
|> get("/api/v1/akkoma/metrics")
|> json_response(403)
end
+
+ test "should be disabled by export_prometheus_metrics" do
+ clear_config([:instance, :export_prometheus_metrics], false)
+ %{conn: conn} = oauth_access(["admin:metrics"])
+ conn
+ |> get("/api/v1/akkoma/metrics")
+ |> response(404)
+ end
end
end
end
end