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
c57fc849
Commit
c57fc849
authored
Aug 28, 2019
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow tests to ignore recursion
parent
1689559f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
lib/gitlab/graphql/query_analyzers/recursion_analyzer.rb
lib/gitlab/graphql/query_analyzers/recursion_analyzer.rb
+5
-1
spec/support/helpers/graphql_helpers.rb
spec/support/helpers/graphql_helpers.rb
+5
-0
No files found.
lib/gitlab/graphql/query_analyzers/recursion_analyzer.rb
View file @
c57fc849
...
...
@@ -45,13 +45,17 @@ module Gitlab
def
recursion_too_deep?
(
node_name
,
times_encountered
)
return
if
IGNORED_FIELDS
.
include?
(
node_name
)
times_encountered
>
RECURSION_THRESHOLD
times_encountered
>
recursion_threshold
end
def
skip_node?
(
irep_node
)
ast_node
=
irep_node
.
ast_node
!
ast_node
.
is_a?
(
GraphQL
::
Language
::
Nodes
::
Field
)
||
ast_node
.
selections
.
empty?
end
def
recursion_threshold
RECURSION_THRESHOLD
end
end
end
end
...
...
spec/support/helpers/graphql_helpers.rb
View file @
c57fc849
...
...
@@ -129,6 +129,7 @@ module GraphqlHelpers
allow_unlimited_graphql_complexity
allow_unlimited_graphql_depth
allow_high_graphql_recursion
type
=
GitlabSchema
.
types
[
class_name
.
to_s
]
return
""
unless
type
...
...
@@ -277,6 +278,10 @@ module GraphqlHelpers
allow_any_instance_of
(
GitlabSchema
).
to
receive
(
:max_depth
).
and_return
nil
allow
(
GitlabSchema
).
to
receive
(
:max_query_depth
).
with
(
any_args
).
and_return
nil
end
def
allow_high_graphql_recursion
allow_any_instance_of
(
Gitlab
::
Graphql
::
QueryAnalyzers
::
RecursionAnalyzer
).
to
receive
(
:recursion_threshold
).
and_return
1000
end
end
# This warms our schema, doing this as part of loading the helpers to avoid
...
...
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