Aggiunge monitoraggio ops: health check, log scanner, dashboard e notifiche.
Introduce incidenti con dedup, job Sidekiq ogni 3 min, scan log cron, /up/deep, dashboard /admin/ops e push ntfy; include Sentry opzionale e fix test suite. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
32
backend/spec/requests/ops/health_spec.rb
Normal file
32
backend/spec/requests/ops/health_spec.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe "Ops deep health", type: :request do
|
||||
describe "GET /up/deep" do
|
||||
it "restituisce summary JSON" do
|
||||
allow_any_instance_of(Ops::HealthChecks).to receive(:summary).and_return(
|
||||
status: "ok",
|
||||
checked_at: Time.current.iso8601,
|
||||
checks: []
|
||||
)
|
||||
|
||||
get "/up/deep"
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(JSON.parse(response.body)["status"]).to eq("ok")
|
||||
end
|
||||
|
||||
it "richiede token quando OPS_HEALTH_TOKEN è impostato" do
|
||||
allow(ENV).to receive(:[]).and_call_original
|
||||
allow(ENV).to receive(:[]).with("OPS_HEALTH_TOKEN").and_return("secret-token")
|
||||
allow_any_instance_of(Ops::HealthChecks).to receive(:summary).and_return(
|
||||
status: "ok", checked_at: Time.current.iso8601, checks: []
|
||||
)
|
||||
|
||||
get "/up/deep"
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
|
||||
get "/up/deep", headers: { "X-Ops-Token" => "secret-token" }
|
||||
expect(response).to have_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -26,6 +26,15 @@ RSpec.describe "Public regia", type: :request do
|
||||
end
|
||||
|
||||
it "mette in pausa e riprende la diretta" do
|
||||
mtx = instance_double(
|
||||
Mediamtx::Client,
|
||||
set_always_available: true,
|
||||
set_path_recording: true,
|
||||
delete_path: true,
|
||||
list_paths: []
|
||||
)
|
||||
allow(Mediamtx::Client).to receive(:new).and_return(mtx)
|
||||
|
||||
token = Sessions::RegiaAccess.new(session).issue_token!
|
||||
post public_regia_pause_path(token)
|
||||
expect(response).to have_http_status(:ok)
|
||||
|
||||
Reference in New Issue
Block a user