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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
289fae78
Commit
289fae78
authored
Jun 28, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename flipper_group to feature_group
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
94b67374
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
doc/api/features.md
doc/api/features.md
+2
-2
lib/api/features.rb
lib/api/features.rb
+4
-4
spec/requests/api/features_spec.rb
spec/requests/api/features_spec.rb
+6
-6
No files found.
doc/api/features.md
View file @
289fae78
...
...
@@ -58,10 +58,10 @@ POST /features/:name
| --------- | ---- | -------- | ----------- |
|
`name`
| string | yes | Name of the feature to create or update |
|
`value`
| integer/string | yes |
`true`
or
`false`
to enable/disable, or an integer for percentage of time |
|
`f
lipper_group`
| string | no | A Flipper
group name |
|
`f
eature_group`
| string | no | A Feature
group name |
|
`user`
| string | no | A GitLab username |
Note that
`f
lipper
_group`
and
`user`
are mutually exclusive.
Note that
`f
eature
_group`
and
`user`
are mutually exclusive.
```
bash
curl
--data
"value=30"
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v4/features/new_library
...
...
lib/api/features.rb
View file @
289fae78
...
...
@@ -15,8 +15,8 @@ module API
end
def
gate_target
(
params
)
if
params
[
:f
lipper
_group
]
Feature
.
group
(
params
[
:f
lipper
_group
])
if
params
[
:f
eature
_group
]
Feature
.
group
(
params
[
:f
eature
_group
])
elsif
params
[
:user
]
User
.
find_by_username
(
params
[
:user
])
else
...
...
@@ -40,9 +40,9 @@ module API
end
params
do
requires
:value
,
type:
String
,
desc:
'`true` or `false` to enable/disable, an integer for percentage of time'
optional
:f
lipper_group
,
type:
String
,
desc:
'A Flipper
group name'
optional
:f
eature_group
,
type:
String
,
desc:
'A Feature
group name'
optional
:user
,
type:
String
,
desc:
'A GitLab username'
mutually_exclusive
:f
lipper
_group
,
:user
mutually_exclusive
:f
eature
_group
,
:user
end
post
':name'
do
feature
=
Feature
.
get
(
params
[
:name
])
...
...
spec/requests/api/features_spec.rb
View file @
289fae78
...
...
@@ -88,8 +88,8 @@ describe API::Features do
'gates'
=>
[{
'key'
=>
'boolean'
,
'value'
=>
true
}])
end
it
'creates an enabled feature for the given Flipper group when passed f
lipper
_group=perf_team'
do
post
api
(
"/features/
#{
feature_name
}
"
,
admin
),
value:
'true'
,
f
lipper
_group:
'perf_team'
it
'creates an enabled feature for the given Flipper group when passed f
eature
_group=perf_team'
do
post
api
(
"/features/
#{
feature_name
}
"
,
admin
),
value:
'true'
,
f
eature
_group:
'perf_team'
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
).
to
eq
(
...
...
@@ -147,8 +147,8 @@ describe API::Features do
'gates'
=>
[{
'key'
=>
'boolean'
,
'value'
=>
true
}])
end
it
'enables the feature for the given Flipper group when passed f
lipper
_group=perf_team'
do
post
api
(
"/features/
#{
feature_name
}
"
,
admin
),
value:
'true'
,
f
lipper
_group:
'perf_team'
it
'enables the feature for the given Flipper group when passed f
eature
_group=perf_team'
do
post
api
(
"/features/
#{
feature_name
}
"
,
admin
),
value:
'true'
,
f
eature
_group:
'perf_team'
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
).
to
eq
(
...
...
@@ -188,11 +188,11 @@ describe API::Features do
'gates'
=>
[{
'key'
=>
'boolean'
,
'value'
=>
false
}])
end
it
'disables the feature for the given Flipper group when passed f
lipper
_group=perf_team'
do
it
'disables the feature for the given Flipper group when passed f
eature
_group=perf_team'
do
feature
.
enable
(
Feature
.
group
(
:perf_team
))
expect
(
Feature
.
get
(
feature_name
).
enabled?
(
admin
)).
to
be_truthy
post
api
(
"/features/
#{
feature_name
}
"
,
admin
),
value:
'false'
,
f
lipper
_group:
'perf_team'
post
api
(
"/features/
#{
feature_name
}
"
,
admin
),
value:
'false'
,
f
eature
_group:
'perf_team'
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
).
to
eq
(
...
...
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