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
4026809d
Commit
4026809d
authored
Apr 15, 2021
by
Rajendra Kadam
Committed by
Mikołaj Wawrzyniak
Apr 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Override min/max for nonsql metrics
parent
a950f7ac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
+45
-0
ee/spec/lib/ee/gitlab/usage_data_non_sql_metrics_spec.rb
ee/spec/lib/ee/gitlab/usage_data_non_sql_metrics_spec.rb
+21
-0
lib/gitlab/usage_data_non_sql_metrics.rb
lib/gitlab/usage_data_non_sql_metrics.rb
+6
-0
spec/lib/gitlab/usage_data_non_sql_metrics_spec.rb
spec/lib/gitlab/usage_data_non_sql_metrics_spec.rb
+18
-0
No files found.
ee/spec/lib/ee/gitlab/usage_data_non_sql_metrics_spec.rb
0 → 100644
View file @
4026809d
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
UsageDataNonSqlMetrics
do
include
UsageDataHelpers
before
do
stub_usage_data_connections
end
describe
'.uncached_data'
do
it
'does not make DB calls'
do
recorder
=
ActiveRecord
::
QueryRecorder
.
new
do
described_class
.
uncached_data
end
expect
(
recorder
.
count
).
to
eq
(
74
)
end
end
end
lib/gitlab/usage_data_non_sql_metrics.rb
View file @
4026809d
...
...
@@ -24,6 +24,12 @@ module Gitlab
def
histogram
(
relation
,
column
,
buckets
:,
bucket_size:
buckets
.
size
)
SQL_METRIC_DEFAULT
end
def
maximum_id
(
model
)
end
def
minimum_id
(
model
)
end
end
end
end
spec/lib/gitlab/usage_data_non_sql_metrics_spec.rb
View file @
4026809d
...
...
@@ -34,4 +34,22 @@ RSpec.describe Gitlab::UsageDataNonSqlMetrics do
expect
(
described_class
.
histogram
(
JiraImportState
.
finished
,
:imported_issues_count
,
buckets:
[],
bucket_size:
0
)).
to
eq
(
default_count
)
end
end
describe
'min/max methods'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:model
,
:result
)
do
User
|
nil
Issue
|
nil
Deployment
|
nil
Project
|
nil
end
with_them
do
it
'returns nil'
do
expect
(
described_class
.
minimum_id
(
model
)).
to
eq
(
result
)
expect
(
described_class
.
maximum_id
(
model
)).
to
eq
(
result
)
end
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