mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 07:23:30 +08:00
Follow-up to bc4d4ec027.
Add immediate staff-facing PM whisper feedback when outbound SMTP
sending fails with client errors, reusing the captured SMTP response
details. This aligns send failure diagnostics with existing bounce
visibility in message threads.
Rename the problem check from `EmailDeliveryFailures` to
`EmailSendingFailures` and update related locale keys/messages to use
"sending failure" terminology for consistency.
58 lines
1.6 KiB
Ruby
Vendored
58 lines
1.6 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe ProblemCheck::EmailSendingFailures do
|
|
subject(:check) { described_class.new }
|
|
|
|
describe ".call" do
|
|
before { Jobs.stubs(num_email_retry_jobs: retry_jobs) }
|
|
|
|
let(:retry_jobs) { 0 }
|
|
|
|
context "when there are no recent custom skipped email logs" do
|
|
fab!(:old_failure) do
|
|
Fabricate(
|
|
:skipped_email_log,
|
|
reason_type: SkippedEmailLog.reason_types[:custom],
|
|
custom_reason: "smtp failed",
|
|
created_at: 25.hours.ago,
|
|
)
|
|
end
|
|
|
|
it { expect(check).to be_chill_about_it }
|
|
end
|
|
|
|
context "when there is a recent custom skipped email log" do
|
|
fab!(:recent_failure) do
|
|
Fabricate(
|
|
:skipped_email_log,
|
|
reason_type: SkippedEmailLog.reason_types[:custom],
|
|
custom_reason: "smtp failed",
|
|
created_at: 1.hour.ago,
|
|
)
|
|
end
|
|
|
|
it do
|
|
expect(check).to(
|
|
have_a_problem.with_priority("low").with_message(
|
|
"Email sending has failed once in the past 24 hours. Check the <a href='/admin/email-logs/skipped' target='_blank'>skipped email logs</a> for SMTP error details.",
|
|
),
|
|
)
|
|
end
|
|
end
|
|
|
|
context "when email retry jobs are failing" do
|
|
let(:retry_jobs) { 2 }
|
|
|
|
fab!(:recent_failure) do
|
|
Fabricate(
|
|
:skipped_email_log,
|
|
reason_type: SkippedEmailLog.reason_types[:custom],
|
|
custom_reason: "smtp failed",
|
|
created_at: 1.hour.ago,
|
|
)
|
|
end
|
|
|
|
it { expect(check).to be_chill_about_it }
|
|
end
|
|
end
|
|
end
|