BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9c300fd9
Commit
9c300fd9
authored
Sep 14, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the new query-recorder features as a PoC
parent
6dbd21ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
show_spec.rb
spec/features/milestones/show_spec.rb
+2
-2
projects_spec.rb
spec/requests/api/projects_spec.rb
+3
-3
No files found.
spec/features/milestones/show_spec.rb
View file @
9c300fd9
...
...
@@ -18,9 +18,9 @@ describe 'Milestone show' do
it
'avoids N+1 database queries'
do
create
(
:labeled_issue
,
issue_params
)
control
_count
=
ActiveRecord
::
QueryRecorder
.
new
{
visit_milestone
}.
count
control
=
ActiveRecord
::
QueryRecorder
.
new
{
visit_milestone
}
create_list
(
:labeled_issue
,
10
,
issue_params
)
expect
{
visit_milestone
}.
not_to
exceed_query_limit
(
control
_count
)
expect
{
visit_milestone
}.
not_to
exceed_query_limit
(
control
)
end
end
spec/requests/api/projects_spec.rb
View file @
9c300fd9
...
...
@@ -54,9 +54,9 @@ describe API::Projects do
shared_examples_for
'projects response without N + 1 queries'
do
it
'avoids N + 1 queries'
do
control
_count
=
ActiveRecord
::
QueryRecorder
.
new
do
control
=
ActiveRecord
::
QueryRecorder
.
new
do
get
api
(
'/projects'
,
current_user
)
end
.
count
end
if
defined?
(
additional_project
)
additional_project
...
...
@@ -66,7 +66,7 @@ describe API::Projects do
expect
do
get
api
(
'/projects'
,
current_user
)
end
.
not_to
exceed_query_limit
(
control
_count
+
8
)
end
.
not_to
exceed_query_limit
(
control
).
with_threshold
(
8
)
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