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>
25 lines
710 B
Ruby
25 lines
710 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe Ops::LogPatternMatcher do
|
|
subject(:matcher) do
|
|
described_class.new(
|
|
patterns: [
|
|
{ name: "http_500", severity: "warning", regex: /Completed 500/i },
|
|
{ name: "disk_full", severity: "critical", regex: /No space left on device/i }
|
|
]
|
|
)
|
|
end
|
|
|
|
it "trova pattern nei log" do
|
|
log = <<~LOG
|
|
I, [2026-06-10T19:45:10] Completed 500 Internal Server Error
|
|
E, [2026-06-10T19:45:11] No space left on device - /recordings
|
|
LOG
|
|
|
|
matches = matcher.scan(log)
|
|
|
|
expect(matches.map(&:name)).to contain_exactly("http_500", "disk_full")
|
|
expect(matches.find { |m| m.name == "disk_full" }.severity).to eq("critical")
|
|
end
|
|
end
|