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
5dc8dffd
Commit
5dc8dffd
authored
Oct 22, 2021
by
Philip Cunningham
Committed by
Thong Kuah
Oct 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass Dast::Profile in profile schedule worker
- Passes along profile rather than individual child profiles
parent
54cf5455
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
ee/app/workers/app_sec/dast/profile_schedule_worker.rb
ee/app/workers/app_sec/dast/profile_schedule_worker.rb
+1
-4
ee/spec/workers/app_sec/dast/profile_schedule_worker_spec.rb
ee/spec/workers/app_sec/dast/profile_schedule_worker_spec.rb
+15
-5
No files found.
ee/app/workers/app_sec/dast/profile_schedule_worker.rb
View file @
5dc8dffd
...
...
@@ -37,10 +37,7 @@ module AppSec
::
AppSec
::
Dast
::
Scans
::
CreateService
.
new
(
container:
schedule
.
project
,
current_user:
schedule
.
owner
,
params:
{
dast_site_profile:
schedule
.
dast_profile
.
dast_site_profile
,
dast_scanner_profile:
schedule
.
dast_profile
.
dast_scanner_profile
}
params:
{
dast_profile:
schedule
.
dast_profile
}
)
end
...
...
ee/spec/workers/app_sec/dast/profile_schedule_worker_spec.rb
View file @
5dc8dffd
...
...
@@ -34,9 +34,11 @@ RSpec.describe AppSec::Dast::ProfileScheduleWorker do
it
'does not call runnable_schedules'
do
expect
(
::
Dast
::
ProfileSchedule
).
not_to
receive
(
:runnable_schedules
)
subject
end
end
context
'when feature is licensed'
do
before
do
stub_licensed_features
(
security_on_demand_scans:
true
)
...
...
@@ -83,9 +85,11 @@ RSpec.describe AppSec::Dast::ProfileScheduleWorker do
end
end
it
'sets active to false'
do
it
'sets active to false'
,
:aggregate_failures
do
expect
(
service
).
to
receive
(
:execute
)
subject
expect
(
Dast
::
ProfileSchedule
.
where
(
active:
false
).
count
).
to
eq
(
2
)
end
end
...
...
@@ -96,7 +100,7 @@ RSpec.describe AppSec::Dast::ProfileScheduleWorker do
schedule
.
update_column
(
:next_run_at
,
1
.
minute
.
ago
)
end
it
'executes the
rule schedule service'
do
it
'executes the
service that creates dast scans'
,
:aggregate_failures
do
expect_next_found_instance_of
(
::
Dast
::
ProfileSchedule
)
do
|
schedule
|
expect
(
schedule
).
to
receive
(
:schedule_next_run!
)
end
...
...
@@ -106,6 +110,12 @@ RSpec.describe AppSec::Dast::ProfileScheduleWorker do
subject
end
it
'calls the service that creates dast scans with the correct parameters'
do
expect
(
::
AppSec
::
Dast
::
Scans
::
CreateService
).
to
receive
(
:new
).
with
(
container:
project
,
current_user:
owner
,
params:
{
dast_profile:
schedule
.
dast_profile
})
subject
end
context
'when the schedule owner is invalid'
do
before
do
schedule
.
update_column
(
:user_id
,
nil
)
...
...
@@ -140,19 +150,19 @@ RSpec.describe AppSec::Dast::ProfileScheduleWorker do
schedule
.
update_column
(
:next_run_at
,
1
.
minute
.
from_now
)
end
it
'
executes the rule schedule service
'
do
it
'
does not execute the service that creates dast scans
'
do
expect
(
::
AppSec
::
Dast
::
Scans
::
CreateService
).
not_to
receive
(
:new
)
subject
end
end
context
'when
single run schedule
exists'
do
context
'when
a schedule that does not repeat
exists'
do
before
do
schedule
.
update_columns
(
next_run_at:
1
.
minute
.
ago
,
cadence:
{})
end
it
'
executes the rule schedule service and deactivate the schedul
e'
,
:aggregate_failures
do
it
'
sets active to fals
e'
,
:aggregate_failures
do
expect
(
schedule
.
repeat?
).
to
be
(
false
)
subject
...
...
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