Evita 500 senza SMTP e chiude gli incidenti overflow stale.
Reset password e mail replay usano deliver_mail; il health check overflow risolve tutte le fingerprint del kind, non solo quella sana. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -40,6 +40,44 @@ RSpec.describe Ops::HealthChecks do
|
||||
|
||||
expect(Ops::Incident.find_by(fingerprint: "disk_space:root").status).to eq("resolved")
|
||||
end
|
||||
|
||||
it "chiude gli incidenti overflow anche se la fingerprint sana è diversa" do
|
||||
Ops::Incident.create!(
|
||||
kind: "stream_overflow",
|
||||
severity: "warning",
|
||||
status: "open",
|
||||
title: "Capacità stream al massimo",
|
||||
message: "overflow=3/3",
|
||||
metadata: {},
|
||||
fingerprint: "stream_overflow:at_max",
|
||||
occurrence_count: 1,
|
||||
first_seen_at: Time.current,
|
||||
last_seen_at: Time.current
|
||||
)
|
||||
|
||||
allow_any_instance_of(described_class).to receive(:check_stream_overflow).and_return(
|
||||
described_class::Finding.new(
|
||||
kind: "stream_overflow", severity: "info", healthy: true,
|
||||
title: "Overflow streaming OK", message: "OK", metadata: {}, fingerprint: "stream_overflow:ok"
|
||||
)
|
||||
)
|
||||
%i[
|
||||
check_disk_root check_recordings_size check_postgres check_redis check_mediamtx check_garage
|
||||
check_sidekiq_heartbeat check_sidekiq_dead check_http_rails check_rails_latency
|
||||
].each do |method|
|
||||
allow_any_instance_of(described_class).to receive(method).and_return(
|
||||
described_class::Finding.new(
|
||||
kind: "test", severity: "info", healthy: true,
|
||||
title: "OK", message: "OK", metadata: {}, fingerprint: "#{method}:ok"
|
||||
)
|
||||
)
|
||||
end
|
||||
allow_any_instance_of(described_class).to receive(:public_check_due?).and_return(false)
|
||||
|
||||
described_class.new.call
|
||||
|
||||
expect(Ops::Incident.find_by(fingerprint: "stream_overflow:at_max").status).to eq("resolved")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#summary" do
|
||||
|
||||
@@ -52,4 +52,28 @@ RSpec.describe Ops::IncidentRecorder do
|
||||
expect(incident.reload.status).to eq("resolved")
|
||||
end
|
||||
end
|
||||
|
||||
describe ".resolve_kind" do
|
||||
it "chiude tutti gli incidenti aperti di quel kind" do
|
||||
at_max = described_class.record(
|
||||
kind: "stream_overflow",
|
||||
severity: "warning",
|
||||
title: "Max",
|
||||
message: "max",
|
||||
fingerprint: "stream_overflow:at_max"
|
||||
)
|
||||
orphan = described_class.record(
|
||||
kind: "stream_overflow",
|
||||
severity: "warning",
|
||||
title: "Idle",
|
||||
message: "idle",
|
||||
fingerprint: "stream_overflow:orphan_idle"
|
||||
)
|
||||
|
||||
described_class.resolve_kind("stream_overflow")
|
||||
|
||||
expect(at_max.reload.status).to eq("resolved")
|
||||
expect(orphan.reload.status).to eq("resolved")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user