spec/integration_spec.rb in cf-uaa-lib-3.13.0 vs spec/integration_spec.rb in cf-uaa-lib-3.14.1

- old
+ new

@@ -42,10 +42,38 @@ admin_token_issuer = TokenIssuer.new(target, admin_client, admin_secret, options) Scim.new(target, admin_token_issuer.client_credentials_grant.auth_header, options.merge(:symbolize_keys => true)) end + describe 'when UAA does not respond' do + let(:http_timeout) { 0.01 } + let(:default_http_client_timeout) { 60 } + let(:scim) { Scim.new(@target, "", {:http_timeout => http_timeout}) } + let(:token_issuer) { TokenIssuer.new(@target, "", "", {:http_timeout => http_timeout}) } + let(:blackhole_ip) { '10.255.255.1'} + + before do + @target = "http://#{blackhole_ip}" + end + + it 'times out the connection at the configured time for the scim' do + expect { + Timeout.timeout(default_http_client_timeout - 1) do + scim.get(:user, "admin") + end + }.to raise_error HTTPClient::TimeoutError + end + + it 'times out the connection at the configured time for the token issuer' do + expect { + Timeout.timeout(default_http_client_timeout - 1) do + token_issuer.client_credentials_grant + end + }.to raise_error HTTPClient::TimeoutError + end + end + if ENV['UAA_CLIENT_TARGET'] describe 'UAA Integration:' do let(:options) { @options } let(:token_issuer) { TokenIssuer.new(@target, @test_client, @test_secret, options) } @@ -126,11 +154,11 @@ end end end it 'should report the uaa client version' do - expect(VERSION).to match(/\d.\d.\d/) + expect(VERSION).to match(/\d+.\d+.\d+/) end it 'makes sure the server is there by getting the prompts for an implicit grant' do expect(token_issuer.prompts).to_not be_nil end @@ -207,6 +235,6 @@ end end end end end -end \ No newline at end of file +end