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
8f807824
Commit
8f807824
authored
Mar 23, 2020
by
Sean Arnold
Committed by
Rémy Coutable
Mar 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add safe navigation when parsing issue_id
- Extend sentry detailed error spec
parent
2741e514
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb
...esolvers/error_tracking/sentry_detailed_error_resolver.rb
+1
-1
app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb
...lvers/error_tracking/sentry_error_stack_trace_resolver.rb
+1
-1
spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb
...ers/error_tracking/sentry_detailed_error_resolver_spec.rb
+18
-6
No files found.
app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb
View file @
8f807824
...
...
@@ -9,7 +9,7 @@ module Resolvers
def
resolve
(
**
args
)
current_user
=
context
[
:current_user
]
issue_id
=
GlobalID
.
parse
(
args
[
:id
]).
model_id
issue_id
=
GlobalID
.
parse
(
args
[
:id
])
&
.
model_id
# Get data from Sentry
response
=
::
ErrorTracking
::
IssueDetailsService
.
new
(
...
...
app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb
View file @
8f807824
...
...
@@ -8,7 +8,7 @@ module Resolvers
description:
'ID of the Sentry issue'
def
resolve
(
**
args
)
issue_id
=
GlobalID
.
parse
(
args
[
:id
]).
model_id
issue_id
=
GlobalID
.
parse
(
args
[
:id
])
&
.
model_id
# Get data from Sentry
response
=
::
ErrorTracking
::
IssueLatestEventService
.
new
(
...
...
spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb
View file @
8f807824
...
...
@@ -18,6 +18,16 @@ describe Resolvers::ErrorTracking::SentryDetailedErrorResolver do
.
and_return
issue_details_service
end
shared_examples
'it resolves to nil'
do
it
'resolves to nil'
do
allow
(
issue_details_service
).
to
receive
(
:execute
)
.
and_return
(
issue:
nil
)
result
=
resolve_error
(
args
)
expect
(
result
).
to
be_nil
end
end
describe
'#resolve'
do
let
(
:args
)
{
{
id:
issue_global_id
(
1234
)
}
}
...
...
@@ -32,7 +42,7 @@ describe Resolvers::ErrorTracking::SentryDetailedErrorResolver do
before
do
allow
(
issue_details_service
).
to
receive
(
:execute
)
.
and_return
(
{
issue:
detailed_error
}
)
.
and_return
(
issue:
detailed_error
)
end
it
'resolves to a detailed error'
do
...
...
@@ -44,12 +54,14 @@ describe Resolvers::ErrorTracking::SentryDetailedErrorResolver do
end
end
it
'resolves to nil if no match
'
do
allow
(
issue_details_service
).
to
receive
(
:execute
)
.
and_return
({
issue:
nil
})
context
'if id does not match issue
'
do
it_behaves_like
'it resolves to nil'
end
result
=
resolve_error
(
args
)
expect
(
result
).
to
eq
nil
context
'blank id'
do
let
(
:args
)
{
{
id:
''
}
}
it_behaves_like
'it resolves to nil'
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