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
93883dba
Commit
93883dba
authored
Dec 15, 2020
by
jejacks0n
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assign key as variable
- With some minor spec adjustments
parent
55810a99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
app/experiments/application_experiment.rb
app/experiments/application_experiment.rb
+4
-4
spec/experiments/application_experiment/cache_spec.rb
spec/experiments/application_experiment/cache_spec.rb
+1
-1
spec/experiments/application_experiment_spec.rb
spec/experiments/application_experiment_spec.rb
+1
-1
No files found.
app/experiments/application_experiment.rb
View file @
93883dba
...
...
@@ -43,12 +43,12 @@ class ApplicationExperiment < Gitlab::Experiment
# Clears the entire cache for a given experiment. Be careful with this
# since it would reset all resolved variants for the entire experiment.
def
clear
(
key
:)
key
=
hkey
(
key
)[
0
]
# extract only the first part of the key
pool
do
|
redis
|
unless
%w[hash none]
.
include?
(
redis
.
type
(
hkey
(
key
)[
0
]))
raise
ArgumentError
,
'invalid call to clear a non-hash cache key'
case
redis
.
type
(
key
)
when
'hash'
,
'none'
then
redis
.
del
(
key
)
else
raise
ArgumentError
,
'invalid call to clear a non-hash cache key'
end
redis
.
del
(
hkey
(
key
)[
0
])
end
end
...
...
spec/experiments/application_experiment/cache_spec.rb
View file @
93883dba
...
...
@@ -14,7 +14,7 @@ RSpec.describe ApplicationExperiment::Cache do
shared_state
.
with
{
|
r
|
r
.
del
(
key_name
)
}
end
it
"allows reading, writing and deleting"
do
it
"allows reading, writing and deleting"
,
:aggregate_failures
do
# we test them all together because they are largely interdependent
expect
(
subject
.
read
(
key_field
)).
to
be_nil
...
...
spec/experiments/application_experiment_spec.rb
View file @
93883dba
...
...
@@ -69,7 +69,7 @@ RSpec.describe ApplicationExperiment do
expect
(
subject
.
variant
.
name
).
to
eq
(
'control'
)
end
context
"when
the rollout
out to 100%"
do
context
"when
rolled
out to 100%"
do
it
"returns the first variant name"
do
subject
.
try
(
:variant1
)
{}
subject
.
try
(
:variant2
)
{}
...
...
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