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
f166ff5b
Commit
f166ff5b
authored
Oct 21, 2019
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add URL parameter to force enable experiments
parent
69362941
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
lib/gitlab/experimentation.rb
lib/gitlab/experimentation.rb
+5
-1
spec/lib/gitlab/experimentation_spec.rb
spec/lib/gitlab/experimentation_spec.rb
+18
-0
No files found.
lib/gitlab/experimentation.rb
View file @
f166ff5b
...
...
@@ -43,7 +43,7 @@ module Gitlab
end
def
experiment_enabled?
(
experiment_key
)
Experimentation
.
enabled_for_user?
(
experiment_key
,
experimentation_subject_index
)
Experimentation
.
enabled_for_user?
(
experiment_key
,
experimentation_subject_index
)
||
forced_enabled?
(
experiment_key
)
end
def
track_experiment_event
(
experiment_key
,
action
)
...
...
@@ -94,6 +94,10 @@ module Gitlab
experiment_enabled?
(
experiment_key
)
?
'experimental_group'
:
'control_group'
end
def
forced_enabled?
(
experiment_key
)
params
.
has_key?
(
:force_experiment
)
&&
params
[
:force_experiment
]
==
experiment_key
.
to_s
end
end
class
<<
self
...
...
spec/lib/gitlab/experimentation_spec.rb
View file @
f166ff5b
...
...
@@ -71,6 +71,24 @@ describe Gitlab::Experimentation do
controller
.
experiment_enabled?
(
:test_experiment
)
end
end
describe
'URL parameter to force enable experiment'
do
context
'is not present'
do
it
'returns false'
do
get
:index
,
params:
{
force_experiment: :test_experiment2
}
expect
(
controller
.
experiment_enabled?
(
:test_experiment
)).
to
be_falsey
end
end
context
'is present'
do
it
'returns true'
do
get
:index
,
params:
{
force_experiment: :test_experiment
}
expect
(
controller
.
experiment_enabled?
(
:test_experiment
)).
to
be_truthy
end
end
end
end
describe
'#track_experiment_event'
do
...
...
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