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
end
def integration
return unless Feature.enabled?(:multiple_http_integrations, project)
AlertManagement::HttpIntegrationsFinder.new(
project,
endpoint_identifier: endpoint_identifier,
......
......@@ -8,8 +8,6 @@ module Resolvers
type Types::AlertManagement::IntegrationType.connection_type, null: true
def resolve(**args)
return [] unless Feature.enabled?(:multiple_http_integrations, project)
http_integrations + prometheus_integrations
end
......
......@@ -14,7 +14,7 @@ module AlertManagement
def execute
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)
return error_in_create(integration) unless integration.valid?
......
......@@ -12,7 +12,6 @@ module AlertManagement
def execute
return error_no_permissions unless allowed?
return error_multiple_integrations unless Feature.enabled?(:multiple_http_integrations, integration.project)
if integration.destroy
success
......@@ -40,10 +39,6 @@ module AlertManagement
def error_no_permissions
error(_('You have insufficient permissions to remove this HTTP integration'))
end
def error_multiple_integrations
error(_('Removing integrations is not supported for this project'))
end
end
end
end
......@@ -14,7 +14,6 @@ module AlertManagement
def execute
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)
......@@ -44,10 +43,6 @@ module AlertManagement
def error_no_permissions
error(_('You have insufficient permissions to update this HTTP integration'))
end
def error_multiple_integrations
error(_('Multiple HTTP integrations are not supported for this project'))
end
end
end
end
......@@ -25,7 +25,6 @@ module Projects
private
attr_reader :integration
delegate :alerts_service, :alerts_service_activated?, to: :project
def process_alert
if alert.persisted?
......@@ -115,19 +114,11 @@ module Projects
end
def active_integration?
if Feature.enabled?(:multiple_http_integrations, project)
return true if integration
end
alerts_service_activated?
integration&.active?
end
def valid_token?(token)
if Feature.enabled?(:multiple_http_integrations, project)
return token == integration.token if integration
end
token == alerts_service.token
token == integration.token
end
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
describe '#execute' do
let(:service) { described_class.new(project, nil, payload) }
let(:token) { alerts_service.token }
let(:token) { integration.token }
let(:payload) do
{
'title' => 'Test alert title'
}
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
let(:existing_alert) { create(:alert_management_alert, :from_payload, project: project, payload: payload) }
......
......@@ -22663,9 +22663,6 @@ msgstr ""
msgid "Removes time estimate."
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."
msgstr ""
......
......@@ -89,18 +89,6 @@ RSpec.describe Projects::Alerting::NotificationsController do
make_request
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
context 'without integration parameters specified' do
......
......@@ -28,14 +28,6 @@ RSpec.describe Resolvers::AlertManagement::IntegrationsResolver do
end
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
private
......
......@@ -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'
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
let_it_be(:existing_integration) { create(:alert_management_http_integration, project: project) }
......
......@@ -38,14 +38,6 @@ RSpec.describe AlertManagement::HttpIntegrations::DestroyService do
it_behaves_like 'error response', 'You have insufficient permissions to remove this HTTP integration'
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
before do
allow(integration).to receive(:destroy).and_return(false)
......
......@@ -39,14 +39,6 @@ RSpec.describe AlertManagement::HttpIntegrations::UpdateService do
it_behaves_like 'error response', 'You have insufficient permissions to update this HTTP integration'
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
let(:params) { { name: '' } }
......
......@@ -253,23 +253,6 @@ RSpec.describe Projects::Alerting::NotifyService do
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
let_it_be_with_reload(:integration) { create(:alert_management_http_integration, project: project) }
......@@ -284,7 +267,7 @@ RSpec.describe Projects::Alerting::NotifyService do
integration.update!(active: false)
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'
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