diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 04:35:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 04:35:54 +0000 |
commit | 17cfff2c246b479e4ec51c11cad4628049a5a9b3 (patch) | |
tree | bd43ae8b773f6c5eb8141b2f9a70252c13906e9f /spec/lib/gitlab/http_connection_adapter_spec.rb | |
parent | f07ef899392050329c1ed4de0ae8fd8480021d86 (diff) | |
download | gitlab-ce-17cfff2c246b479e4ec51c11cad4628049a5a9b3.tar.gz |
Add latest changes from gitlab-org/gitlab@15-11-stable-ee15-11-stable
Diffstat (limited to 'spec/lib/gitlab/http_connection_adapter_spec.rb')
-rw-r--r-- | spec/lib/gitlab/http_connection_adapter_spec.rb | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/spec/lib/gitlab/http_connection_adapter_spec.rb b/spec/lib/gitlab/http_connection_adapter_spec.rb index 8b8097f4885..fac0c1a2a9f 100644 --- a/spec/lib/gitlab/http_connection_adapter_spec.rb +++ b/spec/lib/gitlab/http_connection_adapter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::HTTPConnectionAdapter do +RSpec.describe Gitlab::HTTPConnectionAdapter, feature_category: :shared do include StubRequests let(:uri) { URI('https://example.org') } @@ -111,6 +111,42 @@ RSpec.describe Gitlab::HTTPConnectionAdapter do end end + context 'when proxy is enabled' do + before do + stub_env('http_proxy', 'http://proxy.example.com') + end + + it 'proxy stays configured' do + expect(connection.proxy?).to be true + expect(connection.proxy_from_env?).to be true + expect(connection.proxy_address).to eq('proxy.example.com') + end + + context 'when no_proxy matches the request' do + before do + stub_env('no_proxy', 'example.org') + end + + it 'proxy is disabled' do + expect(connection.proxy?).to be false + expect(connection.proxy_from_env?).to be false + expect(connection.proxy_address).to be nil + end + end + + context 'when no_proxy does not match the request' do + before do + stub_env('no_proxy', 'example.com') + end + + it 'proxy stays configured' do + expect(connection.proxy?).to be true + expect(connection.proxy_from_env?).to be true + expect(connection.proxy_address).to eq('proxy.example.com') + end + end + end + context 'when URL scheme is not HTTP/HTTPS' do let(:uri) { URI('ssh://example.org') } |