105852 add specs for upstream failures in appointment booking flow #21377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request reverts the use of a custom error class in the
Eps::AppointmentService
, which turned out to be interfering with the already present and abstracted error handling in the parent base service. I discovered the bug as I was adding unit tests for upstream failures which in turn verify that the appropriate response is propagated as interpreted from the existing error handling logic.Related issue(s)
Testing done
What areas of the site does it impact?
Error handling changes:
modules/vaos/app/services/eps/appointment_service.rb
: Removed generic rescue block to avoid swallowing exceptions and to let them propagate properly.modules/vaos/app/sidekiq/eps/eps_appointment_worker.rb
: Changed the rescue block to handleCommon::Exceptions::BackendServiceException
instead ofEps::AppointmentService::ServiceError
and updated the error message sent to users.Test additions:
modules/vaos/spec/requests/vaos/v2/eps_appointments_spec.rb
: Added new contexts to test 404 and 500 error responses when fetching EPS appointments.modules/vaos/spec/services/eps/appointment_service_spec.rb
: Updated test to expectCommon::Exceptions::BackendServiceException
instead ofEps::ServiceError
.modules/vaos/spec/sidekiq/eps_appointment_worker_spec.rb
: Added new contexts to test error handling for 404 and 500 error responses and updated the expected failure messages. [1] [2]VCR cassette updates:
spec/support/vcr_cassettes/vaos/eps/get_appointment/404.yml
: Added new VCR cassette to record 404 error response for fetching EPS appointments.spec/support/vcr_cassettes/vaos/eps/get_appointment/500.yml
: Added new VCR cassette to record 500 error response for fetching EPS appointments.Acceptance criteria
Requested Feedback