Skip to content
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

API-37992-remove-vbms-from-healthchecks #18244

Merged
merged 7 commits into from
Sep 3, 2024
Merged
21 changes: 0 additions & 21 deletions modules/claims_api/config/initializers/okcomputer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,6 @@ def name
end
end

class VbmsCheck < BaseCheck
def check
connection = Faraday::Connection.new
connection.options.timeout = 10
response = connection.get("#{Settings.vbms.url}/vbms-efolder-svc/upload-v1/eFolderUploadService?wsdl")
response.status == 200 ? process_success : process_failure
rescue
process_failure
end

protected

def name
'VBMS'
end
end

OkComputer::Registry.register 'mpi', MpiCheck.new
OkComputer::Registry.register 'bgs-vet_record', BgsCheck.new('vet_record')
OkComputer::Registry.register 'bgs-corporate_update', BgsCheck.new('corporate_update')
Expand All @@ -119,7 +102,3 @@ def name
FaradayBGSCheck.new('IntentToFileWebServiceBean/IntentToFileWebService')
OkComputer::Registry.register 'localbgs-trackeditem',
FaradayBGSCheck.new('TrackedItemService/TrackedItemService')

OkComputer::Registry.register 'vbms', VbmsCheck.new

OkComputer.make_optional %w[vbms bgs-vet_record bgs-corporate_update bgs-contention]
47 changes: 29 additions & 18 deletions modules/claims_api/spec/requests/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,36 @@
expect(response).to have_http_status(:ok)
end

required_upstream_services = %w[mpi]
optional_upstream_services = %w[vbms bgs-vet_record bgs-corporate_update bgs-contention
localbgs-healthcheck]
(required_upstream_services + optional_upstream_services).each do |upstream_service|
it "returns correct status when #{upstream_service} is not healthy" do
allow(MPI::Service).to receive(:service_is_up?).and_return(upstream_service != 'mpi')
allow_any_instance_of(BGS::Services).to receive(:vet_record)
.and_return(Struct.new(:healthy?).new(upstream_service != 'bgs-vet_record'))
allow_any_instance_of(BGS::Services).to receive(:corporate_update)
.and_return(Struct.new(:healthy?).new(upstream_service != 'bgs-corporate_update'))
allow_any_instance_of(BGS::Services).to receive(:contention)
.and_return(Struct.new(:healthy?).new(upstream_service != 'bgs-contention'))
allow_any_instance_of(ClaimsApi::LocalBGS).to receive(:healthcheck)
.and_return(200)
allow_any_instance_of(Faraday::Connection).to receive(:get)
.and_return(upstream_service == 'vbms' ? Struct.new(:status).new(500) : Struct.new(:status).new(200))
it 'returns the correct status when MPI is not healthy' do
allow(MPI::Service).to receive(:service_is_up?).and_return(false)
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['mpi']['success']).to eq(false)
end

local_bgs_services = %i[claimant person org ebenefitsbenftclaim intenttofile trackeditem].freeze
local_bgs_methods = %i[find_poa_by_participant_id find_by_ssn find_poa_history_by_ptcpnt_id
find_benefit_claims_status_by_ptcpnt_id insert_intent_to_file find_tracked_items].freeze
local_bgs_services.each do |local_bgs_service|
it "returns the correct status when the local bgs #{local_bgs_service} is not healthy" do
local_bgs_methods.each do |local_bgs_method|
allow_any_instance_of(ClaimsApi::LocalBGS).to receive(local_bgs_method.to_sym)
.and_return(Struct.new(:healthy?).new(false))
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result["localbgs-#{local_bgs_service}"]['success']).to eq(false)
end
end
end

bgs_services = %i[vet_record corporate_update contention].freeze
bgs_services.each do |service|
stiehlrod marked this conversation as resolved.
Show resolved Hide resolved
it "returns the correct status when the BGS #{service} is not healthy" do
allow_any_instance_of(BGS::Services).to receive(service.to_sym)
.and_return(Struct.new(:healthy?).new(false))
get "/services/claims/#{version}/upstream_healthcheck"
expected_status = required_upstream_services.include?(upstream_service) ? :internal_server_error : :success
expect(response).to have_http_status(expected_status)
result = JSON.parse(response.body)
expect(result["bgs-#{service}"]['success']).to eq(false)
end
end
end
Expand Down
Loading