Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions app/mailers/report_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,4 @@ def system_demand_report(email:, data:, name:)
attachments['system_demand.csv'] = data
mail(to: email, subject: t('report_mailer.system_demand_report.subject'))
end

def warn_error(email:, error:, env: Rails.env)
@error = error
mail(to: email, subject: "[#{env}] identity-idp error: #{error.class.name}")
end
end
8 changes: 1 addition & 7 deletions app/services/service_provider_seeder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ def check_for_missing_sps
extra_sp_error = ExtraServiceProviderError.new(
"Extra service providers found in DB: #{extra_sps.join(', ')}",
)

if IdentityConfig.store.team_ursula_email.present?
ReportMailer.warn_error(
email: IdentityConfig.store.team_ursula_email,
error: extra_sp_error,
).deliver_now_or_later
end
NewRelic::Agent.notice_error(extra_sp_error)
end
end
5 changes: 0 additions & 5 deletions app/views/report_mailer/warn_error.text.erb

This file was deleted.

1 change: 0 additions & 1 deletion config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ sp_handoff_bounce_max_seconds: 2
show_user_attribute_deprecation_warnings: false
otp_min_attempts_remaining_warning_count: 3
system_demand_report_email: 'foo@bar.com'
team_ursula_email: ''
test_ssn_allowed_list: ''
totp_code_interval: 30
unauthorized_scope_enabled: false
Expand Down
1 change: 0 additions & 1 deletion lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ def self.build_store(config_map)
config.add(:sp_handoff_bounce_max_seconds, type: :integer)
config.add(:state_tracking_enabled, type: :boolean)
config.add(:system_demand_report_email, type: :string)
config.add(:team_ursula_email, type: :string)
config.add(:telephony_adapter, type: :string)
config.add(:test_ssn_allowed_list, type: :comma_separated_string_list)
config.add(:totp_code_interval, type: :integer)
Expand Down
10 changes: 0 additions & 10 deletions spec/mailers/previews/report_mailer_preview.rb

This file was deleted.

12 changes: 0 additions & 12 deletions spec/mailers/previews/report_mailer_preview_spec.rb

This file was deleted.

24 changes: 1 addition & 23 deletions spec/mailers/report_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:user) { build(:user) }
let(:email_address) { user.email_addresses.first }

describe '#deleted_user_accounts_report' do
describe 'deleted_user_accounts_report' do
let(:mail) do
ReportMailer.deleted_user_accounts_report(
email: email_address.email,
Expand All @@ -30,26 +30,4 @@
expect(mail.html_part.body).to have_content('issuer2')
end
end

describe '#warn_error' do
let(:error) { RuntimeError.new('this is my test message') }
let(:env) { ActiveSupport::StringInquirer.new('prod') }

let(:mail) do
ReportMailer.warn_error(
email: 'test@example.com',
error: error,
env: env,
)
end

it 'puts the rails env and error in a plaintext email', aggregate_failures: true do
expect(mail.html_part).to be_nil

expect(mail.subject).to include('prod')
expect(mail.subject).to include('RuntimeError')

expect(mail.text_part.body).to include('this is my test')
end
end
end
14 changes: 7 additions & 7 deletions spec/services/service_provider_seeder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@
let(:prod_issuer) { 'urn:gov:login:test-providers:fake-prod-sp' }
let(:unrestricted_issuer) { 'urn:gov:login:test-providers:fake-unrestricted-sp' }

before do
allow(IdentityConfig.store).to receive(:team_ursula_email).and_return('team@example.com')
end

context 'when %{env} is present in the config file' do
let(:deploy_env) { 'dev' }

Expand All @@ -110,10 +106,12 @@
expect(ServiceProvider.find_by(issuer: unrestricted_issuer)).not_to be_present
end

it 'sends an email an error if the DB has an SP not in the config' do
it 'sends New Relic an error if the DB has an SP not in the config' do
allow(NewRelic::Agent).to receive(:notice_error)
create(:service_provider, issuer: 'missing_issuer')
run

expect { run }.to change { ActionMailer::Base.deliveries.count }.by(1)
expect(NewRelic::Agent).to have_received(:notice_error)
end
end

Expand All @@ -130,9 +128,11 @@
end

it 'sends New Relic an error if the DB has an SP not in the config' do
allow(NewRelic::Agent).to receive(:notice_error)
create(:service_provider, issuer: 'missing_issuer')
run

expect { run }.to change { ActionMailer::Base.deliveries.count }.by(1)
expect(NewRelic::Agent).to have_received(:notice_error)
end
end

Expand Down