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
fb8bc5d8
Commit
fb8bc5d8
authored
Jan 31, 2022
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cross-database data moditifaction in IngestReportSliceService spec
parent
c2cf9777
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
ee/app/services/security/ingestion/ingest_report_slice_service.rb
...ervices/security/ingestion/ingest_report_slice_service.rb
+2
-4
ee/spec/services/security/ingestion/ingest_report_slice_service_spec.rb
...es/security/ingestion/ingest_report_slice_service_spec.rb
+3
-2
No files found.
ee/app/services/security/ingestion/ingest_report_slice_service.rb
View file @
fb8bc5d8
...
...
@@ -32,10 +32,8 @@ module Security
end
def
execute
::
Gitlab
::
Database
::
QueryAnalyzers
::
PreventCrossDatabaseModification
.
allow_cross_database_modification_within_transaction
(
url:
'https://gitlab.com/gitlab-org/gitlab/-/issues/350092'
)
do
ApplicationRecord
.
transaction
do
TASKS
.
each
{
|
task
|
execute_task
(
task
)
}
end
ApplicationRecord
.
transaction
do
TASKS
.
each
{
|
task
|
execute_task
(
task
)
}
end
@finding_maps
.
map
(
&
:vulnerability_id
)
...
...
ee/spec/services/security/ingestion/ingest_report_slice_service_spec.rb
View file @
fb8bc5d8
...
...
@@ -38,9 +38,10 @@ RSpec.describe Security::Ingestion::IngestReportSliceService do
context
'when an exception happens'
do
let
(
:mock_task_1
)
{
double
(
:task
)
}
let
(
:mock_task_2
)
{
double
(
:task
)
}
let
(
:security_finding
)
{
finding_maps
.
first
.
security_finding
}
before
do
allow
(
mock_task_1
).
to
receive
(
:execute
)
{
|
pipeline
,
*|
pipeline
.
update_column
(
:updated_at
,
3
.
months
.
from_now
)
}
allow
(
mock_task_1
).
to
receive
(
:execute
)
{
|
pipeline
,
*|
security_finding
.
update_column
(
:uuid
,
SecureRandom
.
uuid
)
}
allow
(
mock_task_2
).
to
receive
(
:execute
)
{
raise
'foo'
}
allow
(
Security
::
Ingestion
::
Tasks
).
to
receive
(
:const_get
).
with
(
:IngestIdentifiers
,
false
).
and_return
(
mock_task_1
)
...
...
@@ -49,7 +50,7 @@ RSpec.describe Security::Ingestion::IngestReportSliceService do
it
'rollsback the recent changes to not to leave the database in an inconsistent state'
do
expect
{
ingest_report_slice
}.
to
raise_error
(
'foo'
)
.
and
not_change
{
pipeline
.
reload
.
updated_at
}
.
and
not_change
{
security_finding
.
reload
.
uuid
}
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