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
7ac98184
Commit
7ac98184
authored
Mar 11, 2021
by
James Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a pure N+1 example to the spec
parent
b1521591
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
ee/spec/finders/security/pipeline_vulnerabilities_finder_spec.rb
.../finders/security/pipeline_vulnerabilities_finder_spec.rb
+17
-0
No files found.
ee/spec/finders/security/pipeline_vulnerabilities_finder_spec.rb
View file @
7ac98184
...
@@ -100,11 +100,28 @@ RSpec.describe Security::PipelineVulnerabilitiesFinder do
...
@@ -100,11 +100,28 @@ RSpec.describe Security::PipelineVulnerabilitiesFinder do
# Need to warm the cache
# Need to warm the cache
described_class
.
new
(
pipeline:
pipeline
,
params:
{
report_type:
%w[dependency_scanning]
}).
execute
described_class
.
new
(
pipeline:
pipeline
,
params:
{
report_type:
%w[dependency_scanning]
}).
execute
# should be the same number of queries between different report types
expect
do
expect
do
described_class
.
new
(
pipeline:
pipeline
,
params:
{
report_type:
%w[sast]
}).
execute
described_class
.
new
(
pipeline:
pipeline
,
params:
{
report_type:
%w[sast]
}).
execute
end
.
to
issue_same_number_of_queries_as
{
end
.
to
issue_same_number_of_queries_as
{
described_class
.
new
(
pipeline:
pipeline
,
params:
{
report_type:
%w[dependency_scanning]
}).
execute
described_class
.
new
(
pipeline:
pipeline
,
params:
{
report_type:
%w[dependency_scanning]
}).
execute
}
}
# should also be the same number of queries on the same report type
# with a different number of findings
#
# The pipeline.security_reports object is created dynamically from
# pipeline artifacts. We're caching the value so that we can mock it
# and force it to include another finding.
orig_security_reports
=
pipeline
.
security_reports
new_finding
=
create
(
:ci_reports_security_finding
)
expect
do
described_class
.
new
(
pipeline:
pipeline
,
params:
{
report_type:
%w[sast]
}).
execute
end
.
to
issue_same_number_of_queries_as
{
orig_security_reports
.
reports
[
'sast'
].
add_finding
(
new_finding
)
allow
(
pipeline
).
to
receive
(
:security_reports
).
and_return
(
orig_security_reports
)
described_class
.
new
(
pipeline:
pipeline
,
params:
{
report_type:
%w[sast]
}).
execute
}
end
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