Commit 8ef22332 authored by Sarah Yasonik's avatar Sarah Yasonik Committed by Dmytro Zaporozhets (DZ)

Remove alerts service from tests which don't need it

parent ff9a62a2
...@@ -5,7 +5,6 @@ require 'spec_helper' ...@@ -5,7 +5,6 @@ require 'spec_helper'
RSpec.describe 'User filters Alert Management table by status', :js do RSpec.describe 'User filters Alert Management table by status', :js do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:developer) { create(:user) } let_it_be(:developer) { create(:user) }
let_it_be(:alerts_service) { create(:alerts_service, project: project) }
let_it_be(:alert1, reload: true) { create(:alert_management_alert, :triggered, project: project) } let_it_be(:alert1, reload: true) { create(:alert_management_alert, :triggered, project: project) }
let_it_be(:alert2, reload: true) { create(:alert_management_alert, :acknowledged, project: project) } let_it_be(:alert2, reload: true) { create(:alert_management_alert, :acknowledged, project: project) }
let_it_be(:alert3, reload: true) { create(:alert_management_alert, :acknowledged, project: project) } let_it_be(:alert3, reload: true) { create(:alert_management_alert, :acknowledged, project: project) }
......
...@@ -5,7 +5,6 @@ require 'spec_helper' ...@@ -5,7 +5,6 @@ require 'spec_helper'
RSpec.describe 'User searches Alert Management alerts', :js do RSpec.describe 'User searches Alert Management alerts', :js do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:developer) { create(:user) } let_it_be(:developer) { create(:user) }
let_it_be(:alerts_service) { create(:alerts_service, project: project) }
let_it_be(:alert) { create(:alert_management_alert, project: project, status: 'triggered') } let_it_be(:alert) { create(:alert_management_alert, project: project, status: 'triggered') }
before_all do before_all do
......
...@@ -5,7 +5,6 @@ require 'spec_helper' ...@@ -5,7 +5,6 @@ require 'spec_helper'
RSpec.describe 'User updates Alert Management status', :js do RSpec.describe 'User updates Alert Management status', :js do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:developer) { create(:user) } let_it_be(:developer) { create(:user) }
let_it_be(:alerts_service) { create(:alerts_service, project: project) }
let_it_be(:alert) { create(:alert_management_alert, project: project, status: 'triggered') } let_it_be(:alert) { create(:alert_management_alert, project: project, status: 'triggered') }
before_all do before_all do
......
...@@ -9,7 +9,7 @@ RSpec.describe Types::Projects::ServiceType do ...@@ -9,7 +9,7 @@ RSpec.describe Types::Projects::ServiceType do
it 'resolves the corresponding type for objects' do it 'resolves the corresponding type for objects' do
expect(described_class.resolve_type(build(:jira_service), {})).to eq(Types::Projects::Services::JiraServiceType) expect(described_class.resolve_type(build(:jira_service), {})).to eq(Types::Projects::Services::JiraServiceType)
expect(described_class.resolve_type(build(:service), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:service), {})).to eq(Types::Projects::Services::BaseServiceType)
expect(described_class.resolve_type(build(:alerts_service), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:drone_ci_service), {})).to eq(Types::Projects::Services::BaseServiceType)
expect(described_class.resolve_type(build(:custom_issue_tracker_service), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:custom_issue_tracker_service), {})).to eq(Types::Projects::Services::BaseServiceType)
end end
end end
......
...@@ -15,14 +15,6 @@ RSpec.describe 'projects/settings/operations/show' do ...@@ -15,14 +15,6 @@ RSpec.describe 'projects/settings/operations/show' do
end end
let_it_be(:prometheus_service) { create(:prometheus_service, project: project) } let_it_be(:prometheus_service) { create(:prometheus_service, project: project) }
let_it_be(:alerts_service) { create(:alerts_service, project: project) }
let(:operations_show_locals) do
{
prometheus_service: prometheus_service,
alerts_service: alerts_service
}
end
before_all do before_all do
project.add_maintainer(user) project.add_maintainer(user)
...@@ -35,13 +27,24 @@ RSpec.describe 'projects/settings/operations/show' do ...@@ -35,13 +27,24 @@ RSpec.describe 'projects/settings/operations/show' do
.and_return(error_tracking_setting) .and_return(error_tracking_setting)
allow(view).to receive(:tracing_setting) allow(view).to receive(:tracing_setting)
.and_return(tracing_setting) .and_return(tracing_setting)
allow(view).to receive(:prometheus_service)
.and_return(prometheus_service)
allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_user).and_return(user)
end end
describe 'Operations > Alerts' do
it 'renders the Operations Settings page' do
render
expect(rendered).to have_content _('Alerts')
expect(rendered).to have_content _('Display alerts from all your monitoring tools directly within GitLab.')
end
end
describe 'Operations > Error Tracking' do describe 'Operations > Error Tracking' do
context 'Settings page ' do context 'Settings page ' do
it 'renders the Operations Settings page' do it 'renders the Operations Settings page' do
render template: 'projects/settings/operations/show', locals: operations_show_locals render
expect(rendered).to have_content _('Error tracking') expect(rendered).to have_content _('Error tracking')
expect(rendered).to have_content _('To link Sentry to GitLab, enter your Sentry URL and Auth Token') expect(rendered).to have_content _('To link Sentry to GitLab, enter your Sentry URL and Auth Token')
...@@ -49,10 +52,34 @@ RSpec.describe 'projects/settings/operations/show' do ...@@ -49,10 +52,34 @@ RSpec.describe 'projects/settings/operations/show' do
end end
end end
describe 'Operations > Prometheus' do
context 'when settings_operations_prometheus_service flag is enabled' do
it 'renders the Operations Settings page' do
render
expect(rendered).to have_content _('Prometheus')
expect(rendered).to have_content _('Link Prometheus monitoring to GitLab.')
expect(rendered).to have_content _('To enable the installation of Prometheus on your clusters, deactivate the manual configuration below')
end
end
context 'when settings_operations_prometheus_service is disabled' do
before do
stub_feature_flags(settings_operations_prometheus_service: false)
end
it 'renders the Operations Settings page' do
render
expect(rendered).not_to have_content _('Select the Active checkbox to override the Auto Configuration with custom settings. If unchecked, Auto Configuration settings are used.')
end
end
end
describe 'Operations > Tracing' do describe 'Operations > Tracing' do
context 'with project.tracing_external_url' do context 'with project.tracing_external_url' do
it 'links to project.tracing_external_url' do it 'links to project.tracing_external_url' do
render template: 'projects/settings/operations/show', locals: operations_show_locals render
expect(rendered).to have_link('Tracing', href: tracing_setting.external_url) expect(rendered).to have_link('Tracing', href: tracing_setting.external_url)
end end
...@@ -66,7 +93,7 @@ RSpec.describe 'projects/settings/operations/show' do ...@@ -66,7 +93,7 @@ RSpec.describe 'projects/settings/operations/show' do
end end
it 'sanitizes external_url' do it 'sanitizes external_url' do
render template: 'projects/settings/operations/show', locals: operations_show_locals render
expect(tracing_setting.external_url).to eq(malicious_tracing_url) expect(tracing_setting.external_url).to eq(malicious_tracing_url)
expect(rendered).to have_link('Tracing', href: cleaned_url) expect(rendered).to have_link('Tracing', href: cleaned_url)
...@@ -82,7 +109,7 @@ RSpec.describe 'projects/settings/operations/show' do ...@@ -82,7 +109,7 @@ RSpec.describe 'projects/settings/operations/show' do
end end
it 'links to Tracing page' do it 'links to Tracing page' do
render template: 'projects/settings/operations/show', locals: operations_show_locals render
expect(rendered).to have_link('Tracing', href: project_tracing_path(project)) expect(rendered).to have_link('Tracing', href: project_tracing_path(project))
end end
......
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