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-42609-health-checks-new-services #19954

Merged
merged 15 commits into from
Jan 7, 2025
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
49 changes: 32 additions & 17 deletions modules/claims_api/config/initializers/okcomputer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,39 @@ def faraday_client
end

OkComputer::Registry.register 'mpi', MpiCheck.new
OkComputer::Registry.register 'localbgs-claimant',
FaradayBGSCheck.new('ClaimantServiceBean/ClaimantWebService')
OkComputer::Registry.register 'localbgs-corporate_update',
FaradayBGSCheck.new('CorporateUpdateServiceBean/CorporateUpdateWebService')
OkComputer::Registry.register 'localbgs-person',
FaradayBGSCheck.new('PersonWebServiceBean/PersonWebService')
OkComputer::Registry.register 'form-526-docker-container',
Form526DockerContainerCheck.new('wss-form526-services-web/tools/version.jsp')
OkComputer::Registry.register 'pdf-generator', PDFGenratorCheck.new('form-526ez-pdf-generator/actuator/health')
OkComputer::Registry.register 'localbgs-org',
FaradayBGSCheck.new('OrgWebServiceBean/OrgWebService')
# rubocop:disable Layout/LineLength
OkComputer::Registry.register 'localbgs-ebenefitsbenftclaim',
FaradayBGSCheck.new('EBenefitsBnftClaimStatusWebServiceBean/EBenefitsBnftClaimStatusWebService')
# rubocop:enable Layout/LineLength
OkComputer::Registry.register 'localbgs-intenttofile',
FaradayBGSCheck.new('IntentToFileWebServiceBean/IntentToFileWebService')
OkComputer::Registry.register 'localbgs-trackeditem',
FaradayBGSCheck.new('TrackedItemService/TrackedItemService')
OkComputer::Registry.register 'benefits-documents',
BeneftsDocumentsCheck.new('services/benefits-documents/v1/healthcheck')
OkComputer::Registry.register 'form-526-docker-container',
Form526DockerContainerCheck.new('wss-form526-services-web/tools/version.jsp')
OkComputer::Registry.register 'pdf-generator', PDFGenratorCheck.new('form-526ez-pdf-generator/actuator/health')

services = [
{ name: 'benefit_claim_service', endpoint: 'BenefitClaimServiceBean/BenefitClaimWebService' },
{ name: 'claimant_web_service', endpoint: 'ClaimManagementService/ClaimManagementService' },
{ name: 'claim_management_service', endpoint: 'ClaimantServiceBean/ClaimantWebService' },
{ name: 'contention_service', endpoint: 'ContentionService/ContentionService' },
{ name: 'corporate_update_web_service', endpoint: 'CorporateUpdateServiceBean/CorporateUpdateService' },
{ name: 'e_benefits_bnft_claim_status_web_service',
endpoint: 'EBenefitsBnftClaimStatusWebServiceBean/EBenefitsBnftClaimStatusWebService' },
{ name: 'intent_to_file_web_service', endpoint: 'IntentToFileWebServiceBean/IntentToFileWebService' },
{ name: 'manage_representative_service', endpoint: 'VDC/ManageRepresentativeService' },
{ name: 'person_web_service', endpoint: 'PersonWebServiceBean/PersonWebService' },
{ name: 'standard_data_service', endpoint: 'StandardDataService/StandardDataService' },
{ name: 'vet_record_web_service', endpoint: 'VetRecordServiceBean/VetRecordWebService' },
{ name: 'veteran_representative_service', endpoint: 'VDC/VeteranRepresentativeService' },
{ name: 'vnp_atchms_service', endpoint: 'VnpAtchmsWebServiceBean/VnpAtchmsService' },
{ name: 'vnp_person_service', endpoint: 'VnpPersonWebServiceBean/VnpPersonService' },
{ name: 'vnp_proc_form_service', endpoint: 'VnpProcFormWebServiceBean/VnpProcFormService' },
{ name: 'vnp_proc_service_v2', endpoint: 'VnpProcWebServiceBeanV2/VnpProcServiceV2' },
{ name: 'vnp_ptcpnt_addrs_service', endpoint: 'VnpPtcpntAddrsWebServiceBean/VnpPtcpntAddrsService' },
{ name: 'vnp_ptcpnt_phone_service', endpoint: 'VnpPtcpntPhoneWebServiceBean/VnpPtcpntPhoneService' },
{ name: 'vnp_ptcpnt_service', endpoint: 'VnpPtcpntWebServiceBean/VnpPtcpntService' },
{ name: 'org_web_service', endpoint: 'OrgWebServiceBean/OrgWebService' },
{ name: 'standard_data_web_service', endpoint: 'StandardDataWebServiceBean/StandardDataWebService' },
{ name: 'tracked_item_service', endpoint: 'TrackedItemService/TrackedItemService' }
]
services.each do |service|
OkComputer::Registry.register service[:name], FaradayBGSCheck.new(service[:endpoint])
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

module ClaimsApi
class VeteranRepresentativeService < ClaimsApi::LocalBGS
def bean_name
'VDC/VeteranRepresentativeService'
end

private

def make_request(namespace:, **args)
Expand Down
4 changes: 4 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_atchms_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

module ClaimsApi
class VnpAtchmsService < ClaimsApi::LocalBGS
def bean_name
'VnpAtchmsWebServiceBean/VnpAtchmsService'
end

# Takes an object with a minimum of (other fields are camelized and passed to BGS):
# vnp_proc_id: BGS procID
# atchms_file_nm: File name
Expand Down
4 changes: 4 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_person_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

module ClaimsApi
class VnpPersonService < ClaimsApi::LocalBGS
def bean_name
'VnpPersonWebServiceBean/VnpPersonService'
end

# Takes an object with a minimum of (other fields are camelized and passed to BGS):
# vnp_proc_id: BGS procID
# vnp_ptcpnt_id: Veteran's participant id
Expand Down
4 changes: 4 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_proc_form_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module ClaimsApi
class VnpProcFormService < ClaimsApi::LocalBGS
FORM_TYPE_CD = '21-22'

def bean_name
'VnpProcFormWebServiceBean/VnpProcFormService'
end

def vnp_proc_form_create(options)
vnp_proc_id = options[:vnp_proc_id]
options.delete(:vnp_proc_id)
Expand Down
4 changes: 4 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_proc_service_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module ClaimsApi
class VnpProcServiceV2 < ClaimsApi::LocalBGS
PROC_TYPE_CD = 'POAAUTHZ'

def bean_name
'VnpProcWebServiceBeanV2/VnpProcServiceV2'
end

def vnp_proc_create
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
<arg0>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

module ClaimsApi
class VnpPtcpntAddrsService < ClaimsApi::LocalBGS
def bean_name
'VnpPtcpntAddrsWebServiceBean/VnpPtcpntAddrsService'
end

def vnp_ptcpnt_addrs_create(options)
arg_strg = convert_nil_values(options)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ class VnpPtcpntPhoneService < ClaimsApi::LocalBGS
# vnpPtcpntPhoneCreate - This service is used to create VONAPP participant phone information
DEFAULT_TYPE = 'Daytime' # Daytime and Nighttime are the allowed values

def bean_name
'VnpPtcpntPhoneWebServiceBean/VnpPtcpntPhoneService'
end

def vnp_ptcpnt_phone_create(options)
request_body = construct_body(options)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
Expand Down
5 changes: 5 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_ptcpnt_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
module ClaimsApi
class VnpPtcpntService < ClaimsApi::LocalBGS
# vnpPtcpntCreate - This service is used to create VONAPP participant information
#
def bean_name
'VnpPtcpntWebServiceBean/VnpPtcpntService'
end

def vnp_ptcpnt_create(options)
arg_strg = convert_nil_values(options)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
Expand Down
193 changes: 127 additions & 66 deletions modules/claims_api/spec/requests/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
require 'rails_helper'
require 'bgs/services'
require 'mpi/service'
require 'bgs_service/e_benefits_bnft_claim_status_web_service'
require 'bgs_service/intent_to_file_web_service'
require 'bgs_service/tracked_item_service'
require 'bgs_service/person_web_service'
require 'bgs_service/local_bgs'

RSpec.describe 'ClaimsApi::Metadata', type: :request do
describe '#get /metadata' do
Expand Down Expand Up @@ -58,71 +55,135 @@
expect(result['mpi']['success']).to eq(false)
end

local_bgs_services = %i[claimant org].freeze
local_bgs_methods = %i[find_poa_by_participant_id find_poa_history_by_ptcpnt_id].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

local_tracked_item_service = %i[trackeditem].freeze
local_tracked_item_method = %i[find_tracked_items].freeze
it "returns the correct status when the tracked item service #{local_tracked_item_service} is not healthy" do
allow_any_instance_of(ClaimsApi::TrackedItemService).to receive(local_tracked_item_method.first.to_sym)
it 'returns the correct status when the benefit-claim-service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['benefit_claim_service']['success']).to eq(false)
end

it 'returns the correct status when the e-benefits-bnft-claim-status-web-service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['e_benefits_bnft_claim_status_web_service']['success']).to eq(false)
end

it 'returns the correct status when the claimant service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['claimant_web_service']['success']).to eq(false)
end

it 'returns the correct status when the claim_management_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['claim_management_service']['success']).to eq(false)
end

it 'returns the correct status when the contention_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['contention_service']['success']).to eq(false)
end

it 'returns the correct status when the corporate_update_web_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['corporate_update_web_service']['success']).to eq(false)
end

it 'returns the correct status when the intenttofile is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['intent_to_file_web_service']['success']).to eq(false)
end

it 'returns the correct status when the manage rep service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['manage_representative_service']['success']).to eq(false)
end

it 'returns the correct status when bgs org service is not healthy' do
allow_any_instance_of(ClaimsApi::LocalBGS).to receive(
:find_poa_history_by_ptcpnt_id
)
.and_return(Struct.new(:healthy?).new(false))
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['localbgs-trackeditem']['success']).to eq(false)
end

local_bgs_claims_status_services = %i[ebenefitsbenftclaim]
local_bgs_claims_status_methods = %i[find_benefit_claims_status_by_ptcpnt_id]
local_bgs_claims_status_services.each do |local_bgs_claims_status_service|
it "returns the correct status when the local bgs #{local_bgs_claims_status_service} is not healthy" do
local_bgs_claims_status_methods.each do |local_bgs_claims_status_method|
allow_any_instance_of(ClaimsApi::EbenefitsBnftClaimStatusWebService).to receive(
local_bgs_claims_status_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_claims_status_service}"]['success']).to eq(false)
end
end
end

local_bgs_itf_methods = %i[insert_intent_to_file]
it 'returns the correct status when the local bgs intenttofile is not healthy' do
local_bgs_itf_methods.each do |local_bgs_itf_method|
allow_any_instance_of(ClaimsApi::IntentToFileWebService).to receive(
local_bgs_itf_method.to_sym
)
.and_return(Struct.new(:healthy?).new(false))
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['localbgs-intenttofile']['success']).to eq(false)
end
end

person_web_service = 'person'
local_bgs_person_methods = %i[find_by_ssn]
it "returns the correct status when the local bgs #{person_web_service} is not healthy" do
local_bgs_person_methods.each do |local_bgs_person_method|
allow_any_instance_of(ClaimsApi::PersonWebService).to receive(
local_bgs_person_method.to_sym
)
.and_return(Struct.new(:healthy?).new(false))
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result["localbgs-#{person_web_service}"]['success']).to eq(false)
end
expect(result['org_web_service']['success']).to eq(false)
end

it 'returns the correct status when the person_web_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['person_web_service']['success']).to eq(false)
end

it 'returns the correct status when the bgs standard_data_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['standard_data_web_service']['success']).to eq(false)
end

it 'returns the correct status when the bgs trackeditem is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['tracked_item_service']['success']).to eq(false)
end

it 'returns the correct status when the bgs vet_record service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['vet_record_web_service']['success']).to eq(false)
end

# 'bgs_service/vnp_atchms_service'
it 'returns the correct status when the bgs vnp_atchms_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['vnp_atchms_service']['success']).to eq(false)
end

# 'bgs_service/vnp_person_service'
it 'returns the correct status when the bgs vnp_person_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['vnp_person_service']['success']).to eq(false)
end

# 'bgs_service/vnp_proc_form_service'
it 'returns the correct status when the bgs vnp_proc_form_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['vnp_proc_form_service']['success']).to eq(false)
end

# 'bgs_service/vnp_proc_service_v2'
it 'returns the correct status when the bgs vnp_proc_service_v2 is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['vnp_proc_service_v2']['success']).to eq(false)
end

# 'bgs_service/vnp_ptcpnt_addrs_service'
it 'returns the correct status when the bgs vnp_ptcpnt_addrs_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['vnp_ptcpnt_addrs_service']['success']).to eq(false)
end

# 'bgs_service/vnp_ptcpnt_phone_service'
it 'returns the correct status when the bgs vnp_ptcpnt_phone_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['vnp_ptcpnt_phone_service']['success']).to eq(false)
end

# 'bgs_service/vnp_ptcpnt_service'
it 'returns the correct status when the bgs vnp_ptcpnt_service is not healthy' do
get "/services/claims/#{version}/upstream_healthcheck"
result = JSON.parse(response.body)
expect(result['vnp_ptcpnt_service']['success']).to eq(false)
end
end
end
Expand Down
Loading