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
a4d7f155
Commit
a4d7f155
authored
Jan 15, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend N+1 Builds and Jobs API specs
parent
87cc0373
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+12
-1
spec/requests/api/v3/builds_spec.rb
spec/requests/api/v3/builds_spec.rb
+12
-1
No files found.
spec/requests/api/jobs_spec.rb
View file @
a4d7f155
...
...
@@ -54,8 +54,19 @@ describe API::Jobs do
end
it
'avoids N+1 queries'
,
skip_before_request:
true
do
first_build
=
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
first_build
.
runner
=
create
(
:ci_runner
)
first_build
.
user
=
create
(
:user
)
first_build
.
save
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
go
}.
count
create_list
(
:ci_build
,
5
,
pipeline:
pipeline
)
second_pipeline
=
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
second_build
=
create
(
:ci_build
,
:artifacts
,
pipeline:
second_pipeline
)
second_build
.
runner
=
create
(
:ci_runner
)
second_build
.
user
=
create
(
:user
)
second_build
.
save
expect
{
go
}.
not_to
exceed_query_limit
(
control_count
)
end
...
...
spec/requests/api/v3/builds_spec.rb
View file @
a4d7f155
...
...
@@ -43,8 +43,19 @@ describe API::V3::Builds do
end
it
'avoids N+1 queries'
,
skip_before_request:
true
do
first_build
=
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
first_build
.
runner
=
create
(
:ci_runner
)
first_build
.
user
=
create
(
:user
)
first_build
.
save
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
go
}.
count
create_list
(
:ci_build
,
5
,
pipeline:
pipeline
)
second_pipeline
=
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
second_build
=
create
(
:ci_build
,
:artifacts
,
pipeline:
second_pipeline
)
second_build
.
runner
=
create
(
:ci_runner
)
second_build
.
user
=
create
(
:user
)
second_build
.
save
expect
{
go
}.
not_to
exceed_query_limit
(
control_count
)
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