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
66af8321
Commit
66af8321
authored
Nov 24, 2021
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for the counters for multi_store
parent
6441e975
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
spec/lib/gitlab/redis/multi_store_spec.rb
spec/lib/gitlab/redis/multi_store_spec.rb
+11
-2
No files found.
spec/lib/gitlab/redis/multi_store_spec.rb
View file @
66af8321
...
@@ -114,6 +114,12 @@ RSpec.describe Gitlab::Redis::MultiStore do
...
@@ -114,6 +114,12 @@ RSpec.describe Gitlab::Redis::MultiStore do
end
end
RSpec
.
shared_examples_for
'fallback read from the secondary store'
do
RSpec
.
shared_examples_for
'fallback read from the secondary store'
do
let
(
:counter
)
{
Gitlab
::
Metrics
::
NullMetric
.
instance
}
before
do
allow
(
Gitlab
::
Metrics
).
to
receive
(
:counter
).
and_return
(
counter
)
end
it
'fallback and execute on secondary instance'
do
it
'fallback and execute on secondary instance'
do
expect
(
secondary_store
).
to
receive
(
name
).
with
(
*
args
).
and_call_original
expect
(
secondary_store
).
to
receive
(
name
).
with
(
*
args
).
and_call_original
...
@@ -128,7 +134,7 @@ RSpec.describe Gitlab::Redis::MultiStore do
...
@@ -128,7 +134,7 @@ RSpec.describe Gitlab::Redis::MultiStore do
end
end
it
'increment read fallback count metrics'
do
it
'increment read fallback count metrics'
do
expect
(
multi_store
).
to
receive
(
:increment_read_fallback_count
).
with
(
name
)
expect
(
counter
).
to
receive
(
:increment
).
with
(
command:
name
,
instance_name:
instance_
name
)
subject
subject
end
end
...
@@ -401,9 +407,12 @@ RSpec.describe Gitlab::Redis::MultiStore do
...
@@ -401,9 +407,12 @@ RSpec.describe Gitlab::Redis::MultiStore do
end
end
context
'with unsupported command'
do
context
'with unsupported command'
do
let
(
:counter
)
{
Gitlab
::
Metrics
::
NullMetric
.
instance
}
before
do
before
do
primary_store
.
flushdb
primary_store
.
flushdb
secondary_store
.
flushdb
secondary_store
.
flushdb
allow
(
Gitlab
::
Metrics
).
to
receive
(
:counter
).
and_return
(
counter
)
end
end
let_it_be
(
:key
)
{
"redis:counter"
}
let_it_be
(
:key
)
{
"redis:counter"
}
...
@@ -426,7 +435,7 @@ RSpec.describe Gitlab::Redis::MultiStore do
...
@@ -426,7 +435,7 @@ RSpec.describe Gitlab::Redis::MultiStore do
end
end
it
'increments method missing counter'
do
it
'increments method missing counter'
do
expect
(
multi_store
).
to
receive
(
:increment_method_missing_count
).
with
(
:incr
)
expect
(
counter
).
to
receive
(
:increment
).
with
(
command: :incr
,
instance_name:
instance_name
)
subject
subject
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