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
e7f900a2
Commit
e7f900a2
authored
Jan 26, 2021
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop numeric support for AlertPayloadField
parent
b41c91a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
9 deletions
+4
-9
ee/lib/gitlab/alert_management/alert_payload_field_extractor.rb
.../gitlab/alert_management/alert_payload_field_extractor.rb
+2
-3
ee/spec/lib/gitlab/alert_management/alert_payload_field_extractor_spec.rb
...ab/alert_management/alert_payload_field_extractor_spec.rb
+2
-6
No files found.
ee/lib/gitlab/alert_management/alert_payload_field_extractor.rb
View file @
e7f900a2
...
...
@@ -31,7 +31,8 @@ module Gitlab
)
end
# TODO: Code duplication with Gitlab::InlineHash#merge_keys ahead!
# Code duplication with Gitlab::InlineHash#merge_keys ahead!
# See https://gitlab.com/gitlab-org/gitlab/-/issues/299856
def
deep_traverse
(
hash
)
return
to_enum
(
__method__
,
hash
)
unless
block_given?
...
...
@@ -54,8 +55,6 @@ module Gitlab
'datetime'
when
String
'string'
when
Numeric
'numeric'
when
Array
'array'
end
...
...
ee/spec/lib/gitlab/alert_management/alert_payload_field_extractor_spec.rb
View file @
e7f900a2
...
...
@@ -12,12 +12,10 @@ RSpec.describe Gitlab::AlertManagement::AlertPayloadFieldExtractor do
subject
(
:fields
)
{
extractor
.
extract
(
json
)
}
context
'plain
'
do
describe
'#extract
'
do
before
do
payload
.
merge!
(
str:
'value'
,
int:
23
,
float:
23.5
,
nested:
{
key:
'level1'
,
deep:
{
...
...
@@ -32,11 +30,9 @@ RSpec.describe Gitlab::AlertManagement::AlertPayloadFieldExtractor do
)
end
it
'
work
s'
do
it
'
returns all the possible field combination and types suggestion
s'
do
expect
(
fields
).
to
contain_exactly
(
a_field
([
'str'
],
'Str'
,
'string'
),
a_field
([
'int'
],
'Int'
,
'numeric'
),
a_field
([
'float'
],
'Float'
,
'numeric'
),
a_field
(
%w(nested key)
,
'Key'
,
'string'
),
a_field
(
%w(nested deep key)
,
'Key'
,
'string'
),
a_field
([
'time'
],
'Time'
,
'datetime'
),
...
...
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