Commit 0046ce96 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '343174-lower-jira-timeout' into 'master'

Use default timeouts for Jira calls

See merge request gitlab-org/gitlab!72571
parents 1d98c6c6 9d854558
......@@ -89,7 +89,6 @@ module Integrations
site: URI.join(url, '/').to_s.delete_suffix('/'), # Intended to find the root
context_path: (url.path.presence || '/').delete_suffix('/'),
auth_type: :basic,
read_timeout: 120,
use_cookies: true,
additional_cookies: ['OBBasicAuth=fromDialog'],
use_ssl: url.scheme == 'https'
......
......@@ -32,7 +32,6 @@ module Gitlab
request_params = { headers: headers }
request_params[:body] = body if body.present?
request_params[:headers][:Cookie] = get_cookies if options[:use_cookies]
request_params[:timeout] = options[:read_timeout] if options[:read_timeout]
request_params[:base_uri] = uri.to_s
request_params.merge!(auth_params)
......
......@@ -495,6 +495,18 @@ RSpec.describe Integrations::Jira do
end
end
describe '#client' do
it 'uses the default GitLab::HTTP timeouts' do
timeouts = Gitlab::HTTP::DEFAULT_TIMEOUT_OPTIONS
stub_request(:get, 'http://jira.example.com/foo')
expect(Gitlab::HTTP).to receive(:httparty_perform_request)
.with(Net::HTTP::Get, '/foo', hash_including(timeouts)).and_call_original
jira_integration.client.get('/foo')
end
end
describe '#find_issue' do
let(:issue_key) { 'JIRA-123' }
let(:issue_url) { "#{url}/rest/api/2/issue/#{issue_key}" }
......@@ -503,7 +515,7 @@ RSpec.describe Integrations::Jira do
stub_request(:get, issue_url).with(basic_auth: [username, password])
end
it 'call the Jira API to get the issue' do
it 'calls the Jira API to get the issue' do
jira_integration.find_issue(issue_key)
expect(WebMock).to have_requested(:get, issue_url)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment