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
cc276954
Commit
cc276954
authored
Jul 02, 2021
by
Piotr Skorupa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix hardcoded ids in DatabaseMetric specs
parent
102485c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb
...ab/usage/metrics/instrumentations/database_metric_spec.rb
+8
-7
No files found.
spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb
View file @
cc276954
...
...
@@ -13,9 +13,10 @@ RSpec.describe Gitlab::Usage::Metrics::Instrumentations::DatabaseMetric do
end
describe
'#value'
do
let_it_be
(
:issue_1
)
{
create
(
:issue
,
id:
314
)
}
let_it_be
(
:issue_2
)
{
create
(
:issue
,
id:
451
)
}
let_it_be
(
:issue_3
)
{
create
(
:issue
,
id:
949
)
}
let_it_be
(
:issue_1
)
{
create
(
:issue
)
}
let_it_be
(
:issue_2
)
{
create
(
:issue
)
}
let_it_be
(
:issue_3
)
{
create
(
:issue
)
}
let_it_be
(
:issues
)
{
Issue
.
all
}
before
do
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:transaction_open?
).
and_return
(
false
)
...
...
@@ -28,8 +29,8 @@ RSpec.describe Gitlab::Usage::Metrics::Instrumentations::DatabaseMetric do
it
'does not cache the result of start and finish'
,
:use_clean_rails_redis_caching
do
subject
.
value
expect
(
Rails
.
cache
.
read
(
'metric_instrumentation/
issues
_minimum_id'
)).
to
eq
(
nil
)
expect
(
Rails
.
cache
.
read
(
'metric_instrumentation/
issues
_maximum_id'
)).
to
eq
(
nil
)
expect
(
Rails
.
cache
.
read
(
'metric_instrumentation/
special_issue_count
_minimum_id'
)).
to
eq
(
nil
)
expect
(
Rails
.
cache
.
read
(
'metric_instrumentation/
special_issue_count
_maximum_id'
)).
to
eq
(
nil
)
end
context
'with start and finish not called'
do
...
...
@@ -59,8 +60,8 @@ RSpec.describe Gitlab::Usage::Metrics::Instrumentations::DatabaseMetric do
it
'caches using the key name passed'
,
:use_clean_rails_redis_caching
do
subject
.
value
expect
(
Rails
.
cache
.
read
(
'metric_instrumentation/special_issue_count_minimum_id'
)).
to
eq
(
314
)
expect
(
Rails
.
cache
.
read
(
'metric_instrumentation/special_issue_count_maximum_id'
)).
to
eq
(
949
)
expect
(
Rails
.
cache
.
read
(
'metric_instrumentation/special_issue_count_minimum_id'
)).
to
eq
(
issues
.
min_by
(
&
:id
).
id
)
expect
(
Rails
.
cache
.
read
(
'metric_instrumentation/special_issue_count_maximum_id'
)).
to
eq
(
issues
.
max_by
(
&
:id
).
id
)
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