Skip to content

Commit

Permalink
Merge pull request #2410 from department-of-veterans-affairs/mvi_time…
Browse files Browse the repository at this point in the history
…out_refactor

Add clarity to MVI timeouts
  • Loading branch information
annaswims committed Nov 12, 2018
2 parents 8ed64d1 + add16ee commit a63a93e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
4 changes: 2 additions & 2 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ mhv:
# Settings for Master Veteran Index
mvi:
url: http://ps-dev.commserv.healthevet.va.gov:8110/psim_webservice/IdMWebService
open_timeout: 2
timeout: 10
open_timeout: 15
timeout: 15
mock: false
processing_code: T
client_cert_path: /fake/client/cert/path
Expand Down
2 changes: 0 additions & 2 deletions config/settings/development.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
mvi:
url: http://ps-dev.commserv.healthevet.va.gov:8110/psim_webservice/IdMWebService
open_timeout: 2
timeout: 10
mock: true
processing_code: T
client_cert_path: config/certs/vetsgov-localhost.crt
Expand Down
15 changes: 4 additions & 11 deletions lib/mvi/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@

module MVI
class Configuration < Common::Client::Configuration::SOAP
# :nocov:
def self.default_mvi_open_timeout
Rails.logger.warn 'Settings.mvi.open_timeout not set, using default'
2
def self.open_timeout
Settings.mvi.open_timeout
end

def self.default_mvi_timeout
Rails.logger.warn 'Settings.mvi.timeout not set, using default'
10
def self.read_timeout
Settings.mvi.timeout
end
# :nocov:

OPEN_TIMEOUT = Settings.mvi.open_timeout&.to_i || default_mvi_open_timeout
TIMEOUT = Settings.mvi.timeout&.to_i || default_mvi_timeout

def self.ssl_cert_path
Settings.mvi.client_cert_path
Expand Down
17 changes: 8 additions & 9 deletions spec/lib/mvi/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@
end
end

# TODO(knkski): These tests probably aren't doing anything useful.
describe '.default_mvi_open_timeout' do
context 'when Settings.mvi.open_timeout is not set' do
it 'should use the default' do
expect(MVI::Configuration::OPEN_TIMEOUT).to eq(2)
describe '.open_timeout' do
context 'when Settings.mvi.open_timeout is set' do
it 'should use the setting' do
expect(MVI::Configuration.instance.open_timeout).to eq(15)
end
end
end

describe '.default_mvi_timeout' do
context 'when Settings.mvi.timeout is not set' do
it 'should use the default' do
expect(MVI::Configuration::TIMEOUT).to eq(10)
describe '.read_timeout' do
context 'when Settings.mvi.timeout is set' do
it 'should use the setting' do
expect(MVI::Configuration.instance.read_timeout).to eq(15)
end
end
end
Expand Down

0 comments on commit a63a93e

Please sign in to comment.