Commit 289fae78 authored by Rémy Coutable's avatar Rémy Coutable

Rename flipper_group to feature_group

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 94b67374
...@@ -58,10 +58,10 @@ POST /features/:name ...@@ -58,10 +58,10 @@ POST /features/:name
| --------- | ---- | -------- | ----------- | | --------- | ---- | -------- | ----------- |
| `name` | string | yes | Name of the feature to create or update | | `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 | | `value` | integer/string | yes | `true` or `false` to enable/disable, or an integer for percentage of time |
| `flipper_group` | string | no | A Flipper group name | | `feature_group` | string | no | A Feature group name |
| `user` | string | no | A GitLab username | | `user` | string | no | A GitLab username |
Note that `flipper_group` and `user` are mutually exclusive. Note that `feature_group` and `user` are mutually exclusive.
```bash ```bash
curl --data "value=30" --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/features/new_library curl --data "value=30" --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/features/new_library
......
...@@ -15,8 +15,8 @@ module API ...@@ -15,8 +15,8 @@ module API
end end
def gate_target(params) def gate_target(params)
if params[:flipper_group] if params[:feature_group]
Feature.group(params[:flipper_group]) Feature.group(params[:feature_group])
elsif params[:user] elsif params[:user]
User.find_by_username(params[:user]) User.find_by_username(params[:user])
else else
...@@ -40,9 +40,9 @@ module API ...@@ -40,9 +40,9 @@ module API
end end
params do params do
requires :value, type: String, desc: '`true` or `false` to enable/disable, an integer for percentage of time' requires :value, type: String, desc: '`true` or `false` to enable/disable, an integer for percentage of time'
optional :flipper_group, type: String, desc: 'A Flipper group name' optional :feature_group, type: String, desc: 'A Feature group name'
optional :user, type: String, desc: 'A GitLab username' optional :user, type: String, desc: 'A GitLab username'
mutually_exclusive :flipper_group, :user mutually_exclusive :feature_group, :user
end end
post ':name' do post ':name' do
feature = Feature.get(params[:name]) feature = Feature.get(params[:name])
......
...@@ -88,8 +88,8 @@ describe API::Features do ...@@ -88,8 +88,8 @@ describe API::Features do
'gates' => [{ 'key' => 'boolean', 'value' => true }]) 'gates' => [{ 'key' => 'boolean', 'value' => true }])
end end
it 'creates an enabled feature for the given Flipper group when passed flipper_group=perf_team' do it 'creates an enabled feature for the given Flipper group when passed feature_group=perf_team' do
post api("/features/#{feature_name}", admin), value: 'true', flipper_group: 'perf_team' post api("/features/#{feature_name}", admin), value: 'true', feature_group: 'perf_team'
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
expect(json_response).to eq( expect(json_response).to eq(
...@@ -147,8 +147,8 @@ describe API::Features do ...@@ -147,8 +147,8 @@ describe API::Features do
'gates' => [{ 'key' => 'boolean', 'value' => true }]) 'gates' => [{ 'key' => 'boolean', 'value' => true }])
end end
it 'enables the feature for the given Flipper group when passed flipper_group=perf_team' do it 'enables the feature for the given Flipper group when passed feature_group=perf_team' do
post api("/features/#{feature_name}", admin), value: 'true', flipper_group: 'perf_team' post api("/features/#{feature_name}", admin), value: 'true', feature_group: 'perf_team'
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
expect(json_response).to eq( expect(json_response).to eq(
...@@ -188,11 +188,11 @@ describe API::Features do ...@@ -188,11 +188,11 @@ describe API::Features do
'gates' => [{ 'key' => 'boolean', 'value' => false }]) 'gates' => [{ 'key' => 'boolean', 'value' => false }])
end end
it 'disables the feature for the given Flipper group when passed flipper_group=perf_team' do it 'disables the feature for the given Flipper group when passed feature_group=perf_team' do
feature.enable(Feature.group(:perf_team)) feature.enable(Feature.group(:perf_team))
expect(Feature.get(feature_name).enabled?(admin)).to be_truthy expect(Feature.get(feature_name).enabled?(admin)).to be_truthy
post api("/features/#{feature_name}", admin), value: 'false', flipper_group: 'perf_team' post api("/features/#{feature_name}", admin), value: 'false', feature_group: 'perf_team'
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
expect(json_response).to eq( expect(json_response).to eq(
......
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