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
e443e147
Commit
e443e147
authored
May 11, 2021
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for N+1 in UserReferenceFilter
parent
71dee555
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
spec/lib/banzai/filter/references/user_reference_filter_spec.rb
...ib/banzai/filter/references/user_reference_filter_spec.rb
+21
-0
No files found.
spec/lib/banzai/filter/references/user_reference_filter_spec.rb
View file @
e443e147
...
...
@@ -201,4 +201,25 @@ RSpec.describe Banzai::Filter::References::UserReferenceFilter do
expect
(
filter
.
send
(
:usernames
)).
to
eq
([
user
.
username
])
end
end
context
'checking N+1'
do
let
(
:user2
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:reference2
)
{
user2
.
to_reference
}
let
(
:reference3
)
{
group
.
to_reference
}
it
'does not have N+1 per multiple user references'
,
:use_sql_query_cache
do
markdown
=
"
#{
reference
}
"
control_count
=
ActiveRecord
::
QueryRecorder
.
new
(
skip_cached:
false
)
do
reference_filter
(
markdown
)
end
.
count
markdown
=
"
#{
reference
}
@qwertyuiopzx @wertyuio @ertyu @rtyui
#{
reference2
}
#{
reference3
}
"
expect
do
reference_filter
(
markdown
)
end
.
not_to
exceed_all_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