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
20bada33
Commit
20bada33
authored
Mar 27, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add N+1 query problem specs for Issue and MergeRequest ReferenceFilter classes
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
19a44034
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
spec/lib/banzai/filter/issue_reference_filter_spec.rb
spec/lib/banzai/filter/issue_reference_filter_spec.rb
+13
-0
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
.../lib/banzai/filter/merge_request_reference_filter_spec.rb
+13
-0
No files found.
spec/lib/banzai/filter/issue_reference_filter_spec.rb
View file @
20bada33
...
...
@@ -21,6 +21,19 @@ describe Banzai::Filter::IssueReferenceFilter, lib: true do
end
end
describe
'performance'
do
let
(
:another_issue
)
{
create
(
:issue
,
project:
project
)
}
it
'does not have a N+1 query problem'
do
single_reference
=
"Issue
#{
issue
.
to_reference
}
"
multiple_references
=
"Issues
#{
issue
.
to_reference
}
and
#{
another_issue
.
to_reference
}
"
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
reference_filter
(
single_reference
).
to_html
}.
count
expect
{
reference_filter
(
multiple_references
).
to_html
}.
not_to
exceed_query_limit
(
control_count
)
end
end
context
'internal reference'
do
it_behaves_like
'a reference containing an element node'
...
...
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
View file @
20bada33
...
...
@@ -17,6 +17,19 @@ describe Banzai::Filter::MergeRequestReferenceFilter, lib: true do
end
end
describe
'performance'
do
let
(
:another_merge
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
'fix'
)
}
it
'does not have a N+1 query problem'
do
single_reference
=
"Merge request
#{
merge
.
to_reference
}
"
multiple_references
=
"Merge requests
#{
merge
.
to_reference
}
and
#{
another_merge
.
to_reference
}
"
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
reference_filter
(
single_reference
).
to_html
}.
count
expect
{
reference_filter
(
multiple_references
).
to_html
}.
not_to
exceed_query_limit
(
control_count
)
end
end
context
'internal reference'
do
let
(
:reference
)
{
merge
.
to_reference
}
...
...
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