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
35dd5bb3
Commit
35dd5bb3
authored
Feb 09, 2021
by
Quang-Minh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write tests for ContextPayloadProcessor
Issue
https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/846
parent
41d3a9dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletion
+47
-1
lib/gitlab/error_tracking/processor/context_payload_processor.rb
...lab/error_tracking/processor/context_payload_processor.rb
+1
-1
spec/lib/gitlab/error_tracking/processor/context_payload_processor_spec.rb
...rror_tracking/processor/context_payload_processor_spec.rb
+46
-0
No files found.
lib/gitlab/error_tracking/processor/context_payload_processor.rb
View file @
35dd5bb3
...
...
@@ -12,7 +12,7 @@ module Gitlab
# processor should be removed.
def
process
(
payload
)
context_payload
=
Gitlab
::
ErrorTracking
::
ContextPayloadGenerator
.
generate
(
nil
,
{})
context_payload
.
merge!
(
payload
)
payload
.
deep_merge!
(
context_
payload
)
end
end
end
...
...
spec/lib/gitlab/error_tracking/processor/context_payload_processor_spec.rb
0 → 100644
View file @
35dd5bb3
# frozen_string_literal: true
require
'spec_helper'
require
'rspec-parameterized'
RSpec
.
describe
Gitlab
::
ErrorTracking
::
Processor
::
ContextPayloadProcessor
do
subject
(
:processor
)
{
described_class
.
new
}
before
do
allow_next_instance_of
(
Gitlab
::
ErrorTracking
::
ContextPayloadGenerator
)
do
|
generator
|
allow
(
generator
).
to
receive
(
:generate
).
and_return
(
user:
{
username:
'root'
},
tags:
{
locale:
'en'
,
program:
'test'
,
feature_category:
'feature_a'
,
correlation_id:
'cid'
},
extra:
{
some_info:
'info'
}
)
end
end
it
'merges the context payload into event payload'
do
payload
=
{
user:
{
ip_address:
'127.0.0.1'
},
tags:
{
priority:
'high'
},
extra:
{
sidekiq:
{
class:
'SomeWorker'
,
args:
[
'[FILTERED]'
,
1
,
2
]
}
}
}
processor
.
process
(
payload
)
expect
(
payload
).
to
eql
(
user:
{
ip_address:
'127.0.0.1'
,
username:
'root'
},
tags:
{
priority:
'high'
,
locale:
'en'
,
program:
'test'
,
feature_category:
'feature_a'
,
correlation_id:
'cid'
},
extra:
{
some_info:
'info'
,
sidekiq:
{
class:
'SomeWorker'
,
args:
[
'[FILTERED]'
,
1
,
2
]
}
}
)
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