diff options
author | Stan Hu <stanhu@gmail.com> | 2019-06-26 21:24:14 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-06-26 21:24:14 +0300 |
commit | 8c28c3e84eb3e330f10bf2c765668a23dfce5080 (patch) | |
tree | f48f0f99308bd9c6c81b7d318d79a72d1776f232 /spec | |
parent | 2b00b61eba758baf9d4242ba9c71f2319f8ec428 (diff) | |
parent | cd8aaea36f3c2b69c7c48c00ed56de14267969dd (diff) |
Merge branch 'refactor/remove-sentry-from-app-settings' into 'master'
Remove Sentry settings from application settings
See merge request gitlab-org/gitlab-ce!28447
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/raven_js_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/application_setting_spec.rb | 30 | ||||
-rw-r--r-- | spec/requests/api/helpers_spec.rb | 6 | ||||
-rw-r--r-- | spec/support/helpers/stub_configuration.rb | 6 | ||||
-rw-r--r-- | spec/support/shared_examples/application_setting_examples.rb | 39 |
5 files changed, 9 insertions, 74 deletions
diff --git a/spec/features/raven_js_spec.rb b/spec/features/raven_js_spec.rb index 9a049764dec..a4dd79b3179 100644 --- a/spec/features/raven_js_spec.rb +++ b/spec/features/raven_js_spec.rb @@ -10,7 +10,7 @@ describe 'RavenJS' do end it 'loads raven if sentry is enabled' do - stub_application_setting(clientside_sentry_dsn: 'https://key@domain.com/id', clientside_sentry_enabled: true) + stub_sentry_settings visit new_user_session_path diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index f8dc1541dd3..ab6f6dfe720 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -354,36 +354,6 @@ describe ApplicationSetting do end end - describe 'setting Sentry DSNs' do - context 'server DSN' do - it 'strips leading and trailing whitespace' do - subject.update(sentry_dsn: ' http://test ') - - expect(subject.sentry_dsn).to eq('http://test') - end - - it 'handles nil values' do - subject.update(sentry_dsn: nil) - - expect(subject.sentry_dsn).to be_nil - end - end - - context 'client-side DSN' do - it 'strips leading and trailing whitespace' do - subject.update(clientside_sentry_dsn: ' http://test ') - - expect(subject.clientside_sentry_dsn).to eq('http://test') - end - - it 'handles nil values' do - subject.update(clientside_sentry_dsn: nil) - - expect(subject.clientside_sentry_dsn).to be_nil - end - end - end - describe '#disabled_oauth_sign_in_sources=' do before do allow(Devise).to receive(:omniauth_providers).and_return([:github]) diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb index ed907841bd8..1c69f5dbb67 100644 --- a/spec/requests/api/helpers_spec.rb +++ b/spec/requests/api/helpers_spec.rb @@ -226,10 +226,8 @@ describe API::Helpers do allow_any_instance_of(self.class).to receive(:rack_response) allow(Gitlab::Sentry).to receive(:enabled?).and_return(true) - stub_application_setting( - sentry_enabled: true, - sentry_dsn: "dummy://12345:67890@sentry.localdomain/sentry/42" - ) + stub_sentry_settings + configure_sentry Raven.client.configuration.encoding = 'json' end diff --git a/spec/support/helpers/stub_configuration.rb b/spec/support/helpers/stub_configuration.rb index f6c613ad5aa..0d591f038ce 100644 --- a/spec/support/helpers/stub_configuration.rb +++ b/spec/support/helpers/stub_configuration.rb @@ -81,6 +81,12 @@ module StubConfiguration allow(Gitlab.config.repositories).to receive(:storages).and_return(Settingslogic.new(messages)) end + def stub_sentry_settings + allow(Gitlab.config.sentry).to receive(:enabled).and_return(true) + allow(Gitlab.config.sentry).to receive(:dsn).and_return('dummy://b44a0828b72421a6d8e99efd68d44fa8@example.com/42') + allow(Gitlab.config.sentry).to receive(:clientside_dsn).and_return('dummy://b44a0828b72421a6d8e99efd68d44fa8@example.com/43') + end + def stub_kerberos_setting(messages) allow(Gitlab.config.kerberos).to receive_messages(to_settings(messages)) end diff --git a/spec/support/shared_examples/application_setting_examples.rb b/spec/support/shared_examples/application_setting_examples.rb index 421303c97be..e7ec24c5b7e 100644 --- a/spec/support/shared_examples/application_setting_examples.rb +++ b/spec/support/shared_examples/application_setting_examples.rb @@ -249,43 +249,4 @@ RSpec.shared_examples 'application settings examples' do expect(setting.password_authentication_enabled_for_web?).to be_falsey end - - describe 'sentry settings' do - context 'when the sentry settings are not set in gitlab.yml' do - it 'fallbacks to the settings in the database' do - setting.sentry_enabled = true - setting.sentry_dsn = 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40' - setting.clientside_sentry_enabled = true - setting.clientside_sentry_dsn = 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/41' - - allow(Gitlab.config.sentry).to receive(:enabled).and_return(false) - allow(Gitlab.config.sentry).to receive(:dsn).and_return(nil) - allow(Gitlab.config.sentry).to receive(:clientside_dsn).and_return(nil) - - expect(setting.sentry_enabled).to eq true - expect(setting.sentry_dsn).to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40' - expect(setting.clientside_sentry_enabled).to eq true - expect(setting.clientside_sentry_dsn). to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/41' - end - end - - context 'when the sentry settings are set in gitlab.yml' do - it 'does not fallback to the settings in the database' do - setting.sentry_enabled = false - setting.sentry_dsn = 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40' - setting.clientside_sentry_enabled = false - setting.clientside_sentry_dsn = 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/41' - - allow(Gitlab.config.sentry).to receive(:enabled).and_return(true) - allow(Gitlab.config.sentry).to receive(:dsn).and_return('https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42') - allow(Gitlab.config.sentry).to receive(:clientside_dsn).and_return('https://b44a0828b72421a6d8e99efd68d44fa8@example.com/43') - - expect(setting).not_to receive(:read_attribute) - expect(setting.sentry_enabled).to eq true - expect(setting.sentry_dsn).to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42' - expect(setting.clientside_sentry_enabled).to eq true - expect(setting.clientside_sentry_dsn). to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/43' - end - end - end end |