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
2b507557
Commit
2b507557
authored
Oct 23, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support `/client/features` Unleash endpoint
parent
71f30969
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
19 deletions
+34
-19
ee/changelogs/unreleased/unleash-use-client-features.yml
ee/changelogs/unreleased/unleash-use-client-features.yml
+5
-0
ee/lib/api/unleash.rb
ee/lib/api/unleash.rb
+6
-0
ee/spec/requests/api/unleash_spec.rb
ee/spec/requests/api/unleash_spec.rb
+23
-19
No files found.
ee/changelogs/unreleased/unleash-use-client-features.yml
0 → 100644
View file @
2b507557
---
title
:
Support `/client/features` Unleash endpoint
merge_request
:
author
:
type
:
fixed
ee/lib/api/unleash.rb
View file @
2b507557
...
@@ -19,10 +19,16 @@ module API
...
@@ -19,10 +19,16 @@ module API
status
:ok
status
:ok
end
end
desc
'Get a list of features (deprecated, v2 client support)'
get
'features'
do
get
'features'
do
present
project
,
with:
::
EE
::
API
::
Entities
::
UnleashFeatures
present
project
,
with:
::
EE
::
API
::
Entities
::
UnleashFeatures
end
end
desc
'Get a list of features'
get
'client/features'
do
present
project
,
with:
::
EE
::
API
::
Entities
::
UnleashFeatures
end
post
'client/register'
do
post
'client/register'
do
# not supported yet
# not supported yet
status
:ok
status
:ok
...
...
ee/spec/requests/api/unleash_spec.rb
View file @
2b507557
...
@@ -66,31 +66,35 @@ describe API::Unleash do
...
@@ -66,31 +66,35 @@ describe API::Unleash do
end
end
end
end
describe
'GET /feature_flags/unleash/:project_id/features'
do
%w(/feature_flags/unleash/:project_id/features /feature_flags/unleash/:project_id/client/features)
.
each
do
|
features_endpoint
|
subject
{
get
api
(
"/feature_flags/unleash/
#{
project_id
}
/features"
),
params
,
headers
}
describe
"GET
#{
features_endpoint
}
"
do
let
(
:features_url
)
{
features_endpoint
.
sub
(
':project_id'
,
project_id
)
}
it_behaves_like
'authenticated request'
subject
{
get
api
(
"/feature_flags/unleash/
#{
project_id
}
/features"
),
params
,
headers
}
context
'with a list of feature flag'
do
it_behaves_like
'authenticated request'
let
(
:client
)
{
create
(
:operations_feature_flags_client
,
project:
project
)
}
let
(
:headers
)
{
{
"UNLEASH-INSTANCEID"
=>
client
.
token
}}
let!
(
:enable_feature_flag
)
{
create
(
:operations_feature_flag
,
project:
project
,
name:
'feature1'
,
active:
true
)
}
let!
(
:disabled_feature_flag
)
{
create
(
:operations_feature_flag
,
project:
project
,
name:
'feature2'
,
active:
false
)
}
it
'responds with a list'
do
context
'with a list of feature flag'
do
subject
let
(
:client
)
{
create
(
:operations_feature_flags_client
,
project:
project
)
}
let
(
:headers
)
{
{
"UNLEASH-INSTANCEID"
=>
client
.
token
}}
let!
(
:enable_feature_flag
)
{
create
(
:operations_feature_flag
,
project:
project
,
name:
'feature1'
,
active:
true
)
}
let!
(
:disabled_feature_flag
)
{
create
(
:operations_feature_flag
,
project:
project
,
name:
'feature2'
,
active:
false
)
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
it
'responds with a list'
do
expect
(
json_response
[
'version'
]).
to
eq
(
1
)
subject
expect
(
json_response
[
'features'
]).
not_to
be_empty
expect
(
json_response
[
'features'
].
first
[
'name'
]).
to
eq
(
'feature1'
)
end
it
'matches json schema'
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
subject
expect
(
json_response
[
'version'
]).
to
eq
(
1
)
expect
(
json_response
[
'features'
]).
not_to
be_empty
expect
(
json_response
[
'features'
].
first
[
'name'
]).
to
eq
(
'feature1'
)
end
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
it
'matches json schema'
do
expect
(
response
).
to
match_response_schema
(
'unleash/unleash'
,
dir:
'ee'
)
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'unleash/unleash'
,
dir:
'ee'
)
end
end
end
end
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