Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a02d67fc
Commit
a02d67fc
authored
Aug 29, 2019
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide generic alert endpoint behind a feature flag
parent
2bbde3ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
ee/app/controllers/projects/alert_notifications_controller.rb
...pp/controllers/projects/alert_notifications_controller.rb
+5
-0
ee/spec/controllers/projects/alert_notifications_controller_spec.rb
...ntrollers/projects/alert_notifications_controller_spec.rb
+24
-2
No files found.
ee/app/controllers/projects/alert_notifications_controller.rb
View file @
a02d67fc
...
...
@@ -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
ee/spec/controllers/projects/alert_notifications_controller_spec.rb
View file @
a02d67fc
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment