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
06e771d2
Commit
06e771d2
authored
Mar 20, 2020
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use control_count instead of query_count
This approach checks that new services added not increase query counts.
parent
848e6b2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
spec/controllers/admin/services_controller_spec.rb
spec/controllers/admin/services_controller_spec.rb
+10
-2
No files found.
spec/controllers/admin/services_controller_spec.rb
View file @
06e771d2
...
...
@@ -24,9 +24,17 @@ describe Admin::ServicesController do
end
it
'avoids N+1 queries'
do
query
_count
=
ActiveRecord
::
QueryRecorder
.
new
{
get
:index
}.
count
control
_count
=
ActiveRecord
::
QueryRecorder
.
new
{
get
:index
}.
count
expect
(
query_count
).
to
eq
(
6
)
Service
.
insert_all
(
[
{
template:
true
,
type:
'Service1'
},
{
template:
true
,
type:
'Service2'
},
{
template:
true
,
type:
'Service3'
}
]
)
expect
{
get
:index
}.
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