Commit a02d67fc authored by Vitali Tatarintev's avatar Vitali Tatarintev

Hide generic alert endpoint behind a feature flag

parent 2bbde3ad
......@@ -7,6 +7,7 @@ module Projects
skip_before_action :project
prepend_before_action :repository, :project_without_auth
before_action :check_generic_alert_endpoint_feature_flag!
def create
head :ok
......@@ -22,5 +23,9 @@ module Projects
@project = Project.find_by_full_path("#{namespace}/#{id}")
end
def check_generic_alert_endpoint_feature_flag!
render_404 unless Feature.enabled?(:generic_alert_endpoint, @project)
end
end
end
......@@ -7,10 +7,32 @@ describe Projects::AlertNotificationsController do
set(:environment) { create(:environment, project: project) }
describe 'POST #create' do
it 'returns ok' do
def make_request(opts = {})
post :create, params: project_params, session: { as: :json }
end
context 'when feature flag is on' do
before do
stub_feature_flags(generic_alert_endpoint: true)
end
it 'responds with ok' do
make_request
expect(response).to have_gitlab_http_status(:ok)
end
end
context 'when feature flag is off' do
before do
stub_feature_flags(generic_alert_endpoint: false)
end
it 'responds with not_found' do
make_request
expect(response).to have_gitlab_http_status(:ok)
expect(response).to have_gitlab_http_status(:not_found)
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