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
7b257c7c
Commit
7b257c7c
authored
Mar 11, 2021
by
jejacks0n
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the custom RoundRobin strategy directly
- This will allow us to remove it from ApplicationExperiment.
parent
8d0ec9fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
app/experiments/members/invite_email_experiment.rb
app/experiments/members/invite_email_experiment.rb
+2
-6
spec/experiments/members/invite_email_experiment_spec.rb
spec/experiments/members/invite_email_experiment_spec.rb
+26
-15
No files found.
app/experiments/members/invite_email_experiment.rb
View file @
7b257c7c
...
...
@@ -7,12 +7,8 @@ module Members
INVITE_TYPE
=
'initial_email'
def
rollout_strategy
:round_robin
end
def
variants
%i[avatar permission_info control]
def
resolve_variant_name
Strategy
::
RoundRobin
.
new
(
feature_flag_name
,
%i[avatar permission_info control]
).
execute
end
end
end
spec/experiments/members/invite_email_experiment_spec.rb
View file @
7b257c7c
...
...
@@ -3,26 +3,14 @@
require
'spec_helper'
RSpec
.
describe
Members
::
InviteEmailExperiment
do
subject
:invite_email
do
experiment
(
'members/invite_email'
,
actor:
double
(
'Member'
,
created_by:
double
(
'User'
,
avatar_url:
'_avatar_url_'
)))
end
subject
(
:invite_email
)
{
experiment
(
'members/invite_email'
,
**
context
)
}
let
(
:context
)
{
{
actor:
double
(
'Member'
,
created_by:
double
(
'User'
,
avatar_url:
'_avatar_url_'
))
}
}
before
do
allow
(
invite_email
).
to
receive
(
:enabled?
).
and_return
(
true
)
end
describe
"#rollout_strategy"
do
it
"resolves to round_robin"
do
expect
(
invite_email
.
rollout_strategy
).
to
eq
(
:round_robin
)
end
end
describe
"#variants"
do
it
"has all the expected variants"
do
expect
(
invite_email
.
variants
).
to
match
(
%i[avatar permission_info control]
)
end
end
describe
"exclusions"
,
:experiment
do
it
"excludes when created by is nil"
do
expect
(
experiment
(
'members/invite_email'
)).
to
exclude
(
actor:
double
(
created_by:
nil
))
...
...
@@ -34,4 +22,27 @@ RSpec.describe Members::InviteEmailExperiment do
expect
(
experiment
(
'members/invite_email'
)).
to
exclude
(
actor:
member_without_avatar_url
)
end
end
describe
"variant resolution"
,
:clean_gitlab_redis_shared_state
do
it
"proves out round robin in variant selection"
,
:aggregate_failures
do
instance_1
=
described_class
.
new
(
'members/invite_email'
,
**
context
)
allow
(
instance_1
).
to
receive
(
:enabled?
).
and_return
(
true
)
instance_2
=
described_class
.
new
(
'members/invite_email'
,
**
context
)
allow
(
instance_2
).
to
receive
(
:enabled?
).
and_return
(
true
)
instance_3
=
described_class
.
new
(
'members/invite_email'
,
**
context
)
allow
(
instance_3
).
to
receive
(
:enabled?
).
and_return
(
true
)
instance_1
.
try
{
}
expect
(
instance_1
.
variant
.
name
).
to
eq
(
'permission_info'
)
instance_2
.
try
{
}
expect
(
instance_2
.
variant
.
name
).
to
eq
(
'control'
)
instance_3
.
try
{
}
expect
(
instance_3
.
variant
.
name
).
to
eq
(
'avatar'
)
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