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

Remove BGS-ext services from healthchecks #19587

Merged
merged 6 commits into from
Dec 2, 2024
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
28 changes: 2 additions & 26 deletions modules/claims_api/config/initializers/okcomputer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require 'bgs/services'
require 'mpi/service'
require 'bgs_service/local_bgs'

Expand Down Expand Up @@ -38,28 +37,6 @@ def name
end
end

class BgsCheck < BaseCheck
def initialize(service)
@service = service
end

def check
service = BGS::Services.new(
external_uid: 'healthcheck_uid',
external_key: 'healthcheck_key'
)
service.send(@service).healthy? ? process_success : process_failure
rescue
process_failure
end

protected

def name
"BGS #{@service}"
end
end

class FaradayBGSCheck < BaseCheck
def initialize(endpoint)
@endpoint = endpoint
Expand Down Expand Up @@ -159,11 +136,10 @@ def faraday_client
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')
OkComputer::Registry.register 'bgs-contention', BgsCheck.new('contention')
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 'localbgs-org',
Expand Down
14 changes: 0 additions & 14 deletions modules/claims_api/spec/requests/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
context version do
it 'returns correct response and status when healthy' do
allow(MPI::Service).to receive(:service_is_up?).and_return(true)
allow_any_instance_of(BGS::Services).to receive(:vet_record).and_return(Struct.new(:healthy?).new(true))
allow_any_instance_of(BGS::Services).to receive(:contention).and_return(Struct.new(:healthy?).new(true))
allow_any_instance_of(BGS::Services).to receive(:corporate_update).and_return(Struct.new(:healthy?).new(true))
allow_any_instance_of(ClaimsApi::LocalBGS).to receive(:healthcheck).and_return(200)
allow_any_instance_of(Faraday::Connection).to receive(:get).and_return(Struct.new(:status).new(200))
get "/services/claims/#{version}/upstream_healthcheck"
Expand Down Expand Up @@ -71,17 +68,6 @@
end
end
end

bgs_services = %i[vet_record corporate_update contention].freeze
bgs_services.each do |service|
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"
result = JSON.parse(response.body)
expect(result["bgs-#{service}"]['success']).to eq(false)
end
end
end
end
end
Expand Down
Loading