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
2fbb3cbb
Commit
2fbb3cbb
authored
Aug 30, 2021
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for N+1 in ExternalIssueReferenceFilter
parent
6b983bcb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
spec/lib/banzai/filter/references/external_issue_reference_filter_spec.rb
...filter/references/external_issue_reference_filter_spec.rb
+19
-0
No files found.
spec/lib/banzai/filter/references/external_issue_reference_filter_spec.rb
View file @
2fbb3cbb
...
...
@@ -256,4 +256,23 @@ RSpec.describe Banzai::Filter::References::ExternalIssueReferenceFilter do
it_behaves_like
"external issue tracker"
end
end
context
'checking N+1'
do
let_it_be
(
:integration
)
{
create
(
:redmine_integration
,
project:
project
)
}
let_it_be
(
:issue1
)
{
ExternalIssue
.
new
(
"#123"
,
project
)
}
let_it_be
(
:issue2
)
{
ExternalIssue
.
new
(
"YT-123"
,
project
)
}
before
do
project
.
update!
(
issues_enabled:
false
)
end
it
'does not have N+1 per multiple references per project'
,
:use_sql_query_cache
do
single_reference
=
"External Issue
#{
issue1
.
to_reference
}
"
multiple_references
=
"External Issues
#{
issue1
.
to_reference
}
and
#{
issue2
.
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
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