Commit 1d391c56 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'sy-ff-removal-multiple-http-endpoints' into 'master'

Remove feature flag for HTTP Integration API

See merge request gitlab-org/gitlab!47687
parents 2dddbfac d3250ebe
...@@ -46,8 +46,6 @@ module Projects ...@@ -46,8 +46,6 @@ module Projects
end end
def integration def integration
return unless Feature.enabled?(:multiple_http_integrations, project)
AlertManagement::HttpIntegrationsFinder.new( AlertManagement::HttpIntegrationsFinder.new(
project, project,
endpoint_identifier: endpoint_identifier, endpoint_identifier: endpoint_identifier,
......
...@@ -8,8 +8,6 @@ module Resolvers ...@@ -8,8 +8,6 @@ module Resolvers
type Types::AlertManagement::IntegrationType.connection_type, null: true type Types::AlertManagement::IntegrationType.connection_type, null: true
def resolve(**args) def resolve(**args)
return [] unless Feature.enabled?(:multiple_http_integrations, project)
http_integrations + prometheus_integrations http_integrations + prometheus_integrations
end end
......
...@@ -14,7 +14,7 @@ module AlertManagement ...@@ -14,7 +14,7 @@ module AlertManagement
def execute def execute
return error_no_permissions unless allowed? return error_no_permissions unless allowed?
return error_multiple_integrations unless creation_allowed? && Feature.enabled?(:multiple_http_integrations, project) return error_multiple_integrations unless creation_allowed?
integration = project.alert_management_http_integrations.create(params) integration = project.alert_management_http_integrations.create(params)
return error_in_create(integration) unless integration.valid? return error_in_create(integration) unless integration.valid?
......
...@@ -12,7 +12,6 @@ module AlertManagement ...@@ -12,7 +12,6 @@ module AlertManagement
def execute def execute
return error_no_permissions unless allowed? return error_no_permissions unless allowed?
return error_multiple_integrations unless Feature.enabled?(:multiple_http_integrations, integration.project)
if integration.destroy if integration.destroy
success success
...@@ -40,10 +39,6 @@ module AlertManagement ...@@ -40,10 +39,6 @@ module AlertManagement
def error_no_permissions def error_no_permissions
error(_('You have insufficient permissions to remove this HTTP integration')) error(_('You have insufficient permissions to remove this HTTP integration'))
end end
def error_multiple_integrations
error(_('Removing integrations is not supported for this project'))
end
end end
end end
end end
...@@ -14,7 +14,6 @@ module AlertManagement ...@@ -14,7 +14,6 @@ module AlertManagement
def execute def execute
return error_no_permissions unless allowed? return error_no_permissions unless allowed?
return error_multiple_integrations unless Feature.enabled?(:multiple_http_integrations, integration.project)
params[:token] = nil if params.delete(:regenerate_token) params[:token] = nil if params.delete(:regenerate_token)
...@@ -44,10 +43,6 @@ module AlertManagement ...@@ -44,10 +43,6 @@ module AlertManagement
def error_no_permissions def error_no_permissions
error(_('You have insufficient permissions to update this HTTP integration')) error(_('You have insufficient permissions to update this HTTP integration'))
end end
def error_multiple_integrations
error(_('Multiple HTTP integrations are not supported for this project'))
end
end end
end end
end end
...@@ -25,7 +25,6 @@ module Projects ...@@ -25,7 +25,6 @@ module Projects
private private
attr_reader :integration attr_reader :integration
delegate :alerts_service, :alerts_service_activated?, to: :project
def process_alert def process_alert
if alert.persisted? if alert.persisted?
...@@ -115,19 +114,11 @@ module Projects ...@@ -115,19 +114,11 @@ module Projects
end end
def active_integration? def active_integration?
if Feature.enabled?(:multiple_http_integrations, project) integration&.active?
return true if integration
end
alerts_service_activated?
end end
def valid_token?(token) def valid_token?(token)
if Feature.enabled?(:multiple_http_integrations, project) token == integration.token
return token == integration.token if integration
end
token == alerts_service.token
end end
def bad_request def bad_request
......
---
title: Expose GraphQL API for managing HTTP alerting intergations
merge_request: 47687
author:
type: added
---
name: multiple_http_integrations
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44485
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/255509
milestone: '13.6'
type: development
group: group::health
default_enabled: false
...@@ -7,16 +7,16 @@ RSpec.describe Projects::Alerting::NotifyService do ...@@ -7,16 +7,16 @@ RSpec.describe Projects::Alerting::NotifyService do
describe '#execute' do describe '#execute' do
let(:service) { described_class.new(project, nil, payload) } let(:service) { described_class.new(project, nil, payload) }
let(:token) { alerts_service.token } let(:token) { integration.token }
let(:payload) do let(:payload) do
{ {
'title' => 'Test alert title' 'title' => 'Test alert title'
} }
end end
let(:alerts_service) { create(:alerts_service, project: project) } let(:integration) { create(:alert_management_http_integration, project: project) }
subject { service.execute(token) } subject { service.execute(token, integration) }
context 'existing alert with same payload fingerprint' do context 'existing alert with same payload fingerprint' do
let(:existing_alert) { create(:alert_management_alert, :from_payload, project: project, payload: payload) } let(:existing_alert) { create(:alert_management_alert, :from_payload, project: project, payload: payload) }
......
...@@ -22663,9 +22663,6 @@ msgstr "" ...@@ -22663,9 +22663,6 @@ msgstr ""
msgid "Removes time estimate." msgid "Removes time estimate."
msgstr "" msgstr ""
msgid "Removing integrations is not supported for this project"
msgstr ""
msgid "Removing this group also removes all child projects, including archived projects, and their resources." msgid "Removing this group also removes all child projects, including archived projects, and their resources."
msgstr "" msgstr ""
......
...@@ -89,18 +89,6 @@ RSpec.describe Projects::Alerting::NotificationsController do ...@@ -89,18 +89,6 @@ RSpec.describe Projects::Alerting::NotificationsController do
make_request make_request
end end
end end
context 'when multiple endpoints are disabled' do
before do
stub_feature_flags(multiple_http_integrations: false)
end
it 'does not find an integration' do
expect(notify_service).to receive(:execute).with('some token', nil)
make_request
end
end
end end
context 'without integration parameters specified' do context 'without integration parameters specified' do
......
...@@ -28,14 +28,6 @@ RSpec.describe Resolvers::AlertManagement::IntegrationsResolver do ...@@ -28,14 +28,6 @@ RSpec.describe Resolvers::AlertManagement::IntegrationsResolver do
end end
it { is_expected.to contain_exactly(active_http_integration, prometheus_integration) } it { is_expected.to contain_exactly(active_http_integration, prometheus_integration) }
context 'feature flag is not enabled' do
before do
stub_feature_flags(multiple_http_integrations: false)
end
it { is_expected.to be_empty }
end
end end
private private
......
...@@ -38,14 +38,6 @@ RSpec.describe AlertManagement::HttpIntegrations::CreateService do ...@@ -38,14 +38,6 @@ RSpec.describe AlertManagement::HttpIntegrations::CreateService do
it_behaves_like 'error response', 'You have insufficient permissions to create an HTTP integration for this project' it_behaves_like 'error response', 'You have insufficient permissions to create an HTTP integration for this project'
end end
context 'when feature flag is not enabled' do
before do
stub_feature_flags(multiple_http_integrations: false)
end
it_behaves_like 'error response', 'Multiple HTTP integrations are not supported for this project'
end
context 'when an integration already exists' do context 'when an integration already exists' do
let_it_be(:existing_integration) { create(:alert_management_http_integration, project: project) } let_it_be(:existing_integration) { create(:alert_management_http_integration, project: project) }
......
...@@ -38,14 +38,6 @@ RSpec.describe AlertManagement::HttpIntegrations::DestroyService do ...@@ -38,14 +38,6 @@ RSpec.describe AlertManagement::HttpIntegrations::DestroyService do
it_behaves_like 'error response', 'You have insufficient permissions to remove this HTTP integration' it_behaves_like 'error response', 'You have insufficient permissions to remove this HTTP integration'
end end
context 'when feature flag is not enabled' do
before do
stub_feature_flags(multiple_http_integrations: false)
end
it_behaves_like 'error response', 'Removing integrations is not supported for this project'
end
context 'when an error occurs during removal' do context 'when an error occurs during removal' do
before do before do
allow(integration).to receive(:destroy).and_return(false) allow(integration).to receive(:destroy).and_return(false)
......
...@@ -39,14 +39,6 @@ RSpec.describe AlertManagement::HttpIntegrations::UpdateService do ...@@ -39,14 +39,6 @@ RSpec.describe AlertManagement::HttpIntegrations::UpdateService do
it_behaves_like 'error response', 'You have insufficient permissions to update this HTTP integration' it_behaves_like 'error response', 'You have insufficient permissions to update this HTTP integration'
end end
context 'when feature flag is not enabled' do
before do
stub_feature_flags(multiple_http_integrations: false)
end
it_behaves_like 'error response', 'Multiple HTTP integrations are not supported for this project'
end
context 'when an error occurs during update' do context 'when an error occurs during update' do
let(:params) { { name: '' } } let(:params) { { name: '' } }
......
...@@ -253,23 +253,6 @@ RSpec.describe Projects::Alerting::NotifyService do ...@@ -253,23 +253,6 @@ RSpec.describe Projects::Alerting::NotifyService do
end end
end end
context 'with an Alerts Service' do
let_it_be_with_reload(:integration) { create(:alerts_service, project: project) }
it_behaves_like 'notifcations are handled correctly' do
let(:source) { 'Generic Alert Endpoint' }
end
context 'with deactivated Alerts Service' do
before do
integration.update!(active: false)
end
it_behaves_like 'does not process incident issues due to error', http_status: :forbidden
it_behaves_like 'does not an create alert management alert'
end
end
context 'with an HTTP Integration' do context 'with an HTTP Integration' do
let_it_be_with_reload(:integration) { create(:alert_management_http_integration, project: project) } let_it_be_with_reload(:integration) { create(:alert_management_http_integration, project: project) }
...@@ -284,7 +267,7 @@ RSpec.describe Projects::Alerting::NotifyService do ...@@ -284,7 +267,7 @@ RSpec.describe Projects::Alerting::NotifyService do
integration.update!(active: false) integration.update!(active: false)
end end
it_behaves_like 'does not process incident issues due to error', http_status: :unauthorized it_behaves_like 'does not process incident issues due to error', http_status: :forbidden
it_behaves_like 'does not an create alert management alert' it_behaves_like 'does not an create alert management alert'
end end
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