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
9e6a528b
Commit
9e6a528b
authored
Oct 21, 2020
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check environment for experiment first
parent
2cf100d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
lib/gitlab/experimentation.rb
lib/gitlab/experimentation.rb
+1
-1
spec/lib/gitlab/experimentation_spec.rb
spec/lib/gitlab/experimentation_spec.rb
+8
-0
No files found.
lib/gitlab/experimentation.rb
View file @
9e6a528b
...
...
@@ -201,7 +201,7 @@ module Gitlab
return
false
unless
EXPERIMENTS
.
key?
(
experiment_key
)
experiment
=
experiment
(
experiment_key
)
experiment
.
enabled
?
&&
experiment
.
enabled_for_environment
?
experiment
.
enabled
_for_environment?
&&
experiment
.
enabled
?
end
def
enabled_for_attribute?
(
experiment_key
,
attribute
)
...
...
spec/lib/gitlab/experimentation_spec.rb
View file @
9e6a528b
...
...
@@ -442,6 +442,14 @@ RSpec.describe Gitlab::Experimentation, :snowplow do
let
(
:environment
)
{
::
Gitlab
.
com?
}
it
{
is_expected
.
to
be_falsey
}
it
'ensures the typically less expensive environment is checked before the more expensive call to database for Feature'
do
expect_next_instance_of
(
described_class
::
Experiment
)
do
|
experiment
|
expect
(
experiment
).
not_to
receive
(
:enabled?
)
end
subject
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