-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CST] - Update failed document upload logic #20808
base: master
Are you sure you want to change the base?
Conversation
…ledgement_date for failed uploads
…acknowledgement_date for failed uploads
… set in the upload_status_updater code, udpated tests
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -55,16 +54,6 @@ def send_failed_evidence_submissions | |||
nil | |||
end | |||
|
|||
# This will be used to send an upload failure email | |||
# We created a new personalisation with the obfuscated_file_name so the filename is hidden in the email | |||
def create_personalisation_from_upload(upload) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a helper for this
allow(Rails.logger).to receive(:error) | ||
allow(StatsD).to receive(:increment) | ||
context 'when the FAILED record is for EVSS and doesnt have a va_notify_date' do | ||
context 'when an error occurs' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to wrap these tests in a shared_example? not quite sure what that'd look like but i think its make things a lot cleaner.
it 'successfully enqueues a failure notification mailer to send to the veteran' do | ||
expect(EvidenceSubmission.count).to eq(1) | ||
expect(EvidenceSubmission.va_notify_email_not_queued.length).to eq(1) | ||
expect(vanotify_service).to receive(:send_email).with(send_email_params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would like to add a .and_return()
here but I cant with how we stubbed out the vanotify_service
not sure how we can make this better. Let me know your thoughts.
Summary
Found that the Type 2 errors for upload docs were not populating the
failed_date
in the template_metadata so the failure email job was not working for those.Updated the polling job so that we set this field.
Updated code to set acknowledgment_date for evss and lighthouse type 1 and 2 errors
Updated code to set error_message for evss and lighthouse type 1 and 2 errors
Updated code to set failed_date for evss and lighthouse type 1 and 2 errors
Updated code to set template_metadata -> personalisation -> date_failed for evss and lighthouse type 1 and 2 errors
Updated
app/sidekiq/evss/document_upload.rb
so thatfailed_date
,acknowledgement_date
anderror_message
are set when an evss document upload fails.Updated
app/sidekiq/lighthouse/evidence_submissions/document_upload.rb
so thatfailed_date
,acknowledgement_date
anderror_message
are set when an evss document upload fails.Updated
lib/lighthouse/benefits_documents/upload_status_updater.rb
so thattemplate_metadata -> personalisation -> date_failed
is set. Also imported helpers so that we can use the helper function.Updated
spec/factories/lighthouse/benefits_documents/evidence_submission.rb
so that the factory represented each document upload error type. Also changedbd_evidence_submission_pending
to have a date_submitted that was accurate to what we set in the code.Updated the tests in
spec/lib/lighthouse/benefits_documents/upload_status_updater_spec.rb
Updated the tests in
spec/sidekiq/evss/document_upload_spec.rb
Updated the tests in
spec/sidekiq/lighthouse/evidence_submissions/document_upload_spec.rb
Added more tests to
spec/sidekiq/lighthouse/evidence_submissions/failure_notification_email_job_spec.rb
for the different error typesUpdate the tests in
spec/sidekiq/lighthouse/evidence_submissions/evidence_submission_document_upload_polling_job_spec.rb
Related issue(s)
Testing done
How to Test LH document upload failures for type 1 work correctly and are picked up by cron job
benefits_documents_use_lighthouse
is enabledcst_synchronous_evidence_uploads
is disabledcst_send_evidence_failure_emails
is enabledcst_send_evidence_submission_failure_emails
is enabledEX: @icn = '1012830712V627751' # icn for user 19
app/sidekiq/lighthouse/evidence_submissions/failure_notification_email_job.rb
so that in notify_client.send_email() we replace recipient_identifier: { id_value: icn, id_type: 'ICN' } with email_address: 'YOUR_EMAIL',Lighthouse::EvidenceSubmissions::FailureNotificationEmailJob.perform_async
How to Test LH document upload failures for type 2 work correctly and are picked up by cron job
Screenshots
Note: Optional
What areas of the site does it impact?
CST
Acceptance criteria
Requested Feedback
(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?