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
d5c69035
Commit
d5c69035
authored
Apr 06, 2021
by
Rajendra Kadam
Committed by
Alper Akgun
Apr 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip metric follow up
parent
c2058240
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
15 deletions
+10
-15
lib/gitlab/usage/metric_definition.rb
lib/gitlab/usage/metric_definition.rb
+2
-2
spec/lib/gitlab/usage/metric_definition_spec.rb
spec/lib/gitlab/usage/metric_definition_spec.rb
+8
-13
No files found.
lib/gitlab/usage/metric_definition.rb
View file @
d5c69035
...
@@ -5,7 +5,7 @@ module Gitlab
...
@@ -5,7 +5,7 @@ module Gitlab
class
MetricDefinition
class
MetricDefinition
METRIC_SCHEMA_PATH
=
Rails
.
root
.
join
(
'config'
,
'metrics'
,
'schema.json'
)
METRIC_SCHEMA_PATH
=
Rails
.
root
.
join
(
'config'
,
'metrics'
,
'schema.json'
)
BASE_REPO_PATH
=
'https://gitlab.com/gitlab-org/gitlab/-/blob/master'
BASE_REPO_PATH
=
'https://gitlab.com/gitlab-org/gitlab/-/blob/master'
DEPRECATED_METRIC
_STATUSES
=
%w[deprecated removed]
.
to_set
.
freeze
SKIP_VALIDATION
_STATUSES
=
%w[deprecated removed]
.
to_set
.
freeze
attr_reader
:path
attr_reader
:path
attr_reader
:attributes
attr_reader
:attributes
...
@@ -107,7 +107,7 @@ module Gitlab
...
@@ -107,7 +107,7 @@ module Gitlab
end
end
def
skip_validation?
def
skip_validation?
!!
attributes
[
:skip_validation
]
||
@skip_validation
||
DEPRECATED_METRIC
_STATUSES
.
include?
(
attributes
[
:status
])
!!
attributes
[
:skip_validation
]
||
@skip_validation
||
SKIP_VALIDATION
_STATUSES
.
include?
(
attributes
[
:status
])
end
end
end
end
end
end
...
...
spec/lib/gitlab/usage/metric_definition_spec.rb
View file @
d5c69035
...
@@ -87,26 +87,21 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
...
@@ -87,26 +87,21 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
describe
'statuses'
do
describe
'statuses'
do
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:status
,
:
raise_exception
)
do
where
(
:status
,
:
skip_validation?
)
do
'deprecated'
|
fals
e
'deprecated'
|
tru
e
'removed'
|
fals
e
'removed'
|
tru
e
'data_available'
|
false
'data_available'
|
false
'random'
|
true
'implemented'
|
false
'not_used'
|
false
end
end
with_them
do
with_them
do
subject
(
:validation
)
do
subject
(
:validation
)
do
described_class
.
new
(
path
,
attributes
.
merge
(
{
status:
status
}
)).
validate!
described_class
.
new
(
path
,
attributes
.
merge
(
{
status:
status
}
)).
send
(
:skip_validation?
)
end
end
it
"checks for valid/invalid statuses"
do
it
'returns true/false for skip_validation'
do
if
raise_exception
expect
(
validation
).
to
eq
(
skip_validation?
)
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:track_and_raise_for_dev_exception
).
at_least
(
:once
).
with
(
instance_of
(
Gitlab
::
Usage
::
Metric
::
InvalidMetricError
))
else
expect
(
Gitlab
::
ErrorTracking
).
not_to
receive
(
:track_and_raise_for_dev_exception
)
end
validation
end
end
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