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
ae38614c
Commit
ae38614c
authored
Apr 05, 2022
by
Dominic Bauer
Committed by
Vasilii Iakliushin
Apr 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test scanner creation
Changelog: fixed EE: true
parent
d74aea9c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
ee/app/services/vulnerabilities/create_service_base.rb
ee/app/services/vulnerabilities/create_service_base.rb
+2
-3
ee/spec/services/vulnerabilities/starboard_vulnerability_create_service_spec.rb
...rabilities/starboard_vulnerability_create_service_spec.rb
+14
-0
No files found.
ee/app/services/vulnerabilities/create_service_base.rb
View file @
ae38614c
...
...
@@ -94,9 +94,8 @@ module Vulnerabilities
def
initialize_scanner
(
scanner_hash
)
name
=
scanner_hash
[
:name
]
Vulnerabilities
::
Scanner
.
find_or_initialize_by
(
name:
name
)
do
|
s
|
s
.
project
=
@project
s
.
external_id
=
scanner_hash
[
:id
]
Vulnerabilities
::
Scanner
.
find_or_initialize_by
(
project:
@project
,
external_id:
scanner_hash
[
:id
])
do
|
s
|
s
.
name
=
name
s
.
vendor
=
scanner_hash
.
dig
(
:vendor
,
:name
)
end
end
...
...
ee/spec/services/vulnerabilities/starboard_vulnerability_create_service_spec.rb
View file @
ae38614c
...
...
@@ -93,6 +93,20 @@ RSpec.describe Vulnerabilities::StarboardVulnerabilityCreateService do
expect
(
scanner
.
name
).
to
eq
(
params
.
dig
(
:scanner
,
:name
))
expect
(
scanner
.
vendor
).
to
eq
(
params
.
dig
(
:scanner
,
:vendor
,
:name
))
end
context
'when there is a scanner for a different project'
do
let
(
:other_scanner
)
{
create
(
:vulnerabilities_scanner
,
external_id:
params
.
dig
(
:scanner
,
:id
))
}
it
"does not reuse another project's scanner"
do
subject
expect
(
vulnerability
.
finding
.
scanner
).
not_to
eq
(
other_scanner
)
end
it
'creates a new scanner'
do
expect
{
subject
}.
to
change
{
Vulnerabilities
::
Scanner
.
count
}.
by
(
1
)
end
end
end
context
'with feature disabled'
do
...
...
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