diff options
author | Reuben Pereira <rpereira@gitlab.com> | 2019-07-31 20:38:15 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-07-31 20:38:15 +0300 |
commit | f5213a38cc6f9a80e98e1cbdf59f84352f0731cb (patch) | |
tree | 7bfbd92c5b58717a9c3bf339e1cca6e0ccfc4492 /spec/support | |
parent | 3e63fe70ccff3dc477a1740c0a7f164b7caada1f (diff) |
Add prometheus listen address to whitelist
- Add to whitelist so that even if local requests from hooks and
services are not allowed, the prometheus manual configuration will
still succeed.
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/application_setting_examples.rb | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/spec/support/shared_examples/application_setting_examples.rb b/spec/support/shared_examples/application_setting_examples.rb index 0e6a8059376..a43d2a75082 100644 --- a/spec/support/shared_examples/application_setting_examples.rb +++ b/spec/support/shared_examples/application_setting_examples.rb @@ -63,6 +63,19 @@ RSpec.shared_examples 'application settings examples' do context 'outbound_local_requests_whitelist' do it_behaves_like 'string of domains', :outbound_local_requests_whitelist + + it 'clears outbound_local_requests_whitelist_arrays memoization' do + setting.outbound_local_requests_whitelist_raw = 'example.com' + + expect(setting.outbound_local_requests_whitelist_arrays).to contain_exactly( + [], ['example.com'] + ) + + setting.outbound_local_requests_whitelist_raw = 'gitlab.com' + expect(setting.outbound_local_requests_whitelist_arrays).to contain_exactly( + [], ['gitlab.com'] + ) + end end context 'outbound_local_requests_whitelist_arrays' do @@ -78,7 +91,54 @@ RSpec.shared_examples 'application settings examples' do ] domain_whitelist = ['www.example.com', 'example.com', 'subdomain.example.com'] - expect(setting.outbound_local_requests_whitelist_arrays).to contain_exactly(ip_whitelist, domain_whitelist) + expect(setting.outbound_local_requests_whitelist_arrays).to contain_exactly( + ip_whitelist, domain_whitelist + ) + end + end + + context 'add_to_outbound_local_requests_whitelist' do + it 'adds entry to outbound_local_requests_whitelist' do + setting.outbound_local_requests_whitelist = ['example.com'] + + setting.add_to_outbound_local_requests_whitelist( + ['example.com', '127.0.0.1', 'gitlab.com'] + ) + + expect(setting.outbound_local_requests_whitelist).to contain_exactly( + 'example.com', + '127.0.0.1', + 'gitlab.com' + ) + end + + it 'clears outbound_local_requests_whitelist_arrays memoization' do + setting.outbound_local_requests_whitelist = ['example.com'] + + expect(setting.outbound_local_requests_whitelist_arrays).to contain_exactly( + [], + ['example.com'] + ) + + setting.add_to_outbound_local_requests_whitelist( + ['example.com', 'gitlab.com'] + ) + + expect(setting.outbound_local_requests_whitelist_arrays).to contain_exactly( + [], + ['example.com', 'gitlab.com'] + ) + end + + it 'does not raise error with nil' do + setting.outbound_local_requests_whitelist = nil + + setting.add_to_outbound_local_requests_whitelist(['gitlab.com']) + + expect(setting.outbound_local_requests_whitelist).to contain_exactly('gitlab.com') + expect(setting.outbound_local_requests_whitelist_arrays).to contain_exactly( + [], ['gitlab.com'] + ) end it 'does not raise error with nil' do |