diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-25 18:11:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-25 18:11:14 +0300 |
commit | e7b6cfeafec270237f1d59d950b2d27b4c7de7d1 (patch) | |
tree | a4f15e3dab0c8132005ecba130cd980b361d1f09 /spec/support_specs/database | |
parent | 975eac49924cf0e9c980d970458d14d2ddaa8b55 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support_specs/database')
-rw-r--r-- | spec/support_specs/database/prevent_cross_database_modification_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/support_specs/database/prevent_cross_database_modification_spec.rb b/spec/support_specs/database/prevent_cross_database_modification_spec.rb index 5ea465356a1..e86559bb14a 100644 --- a/spec/support_specs/database/prevent_cross_database_modification_spec.rb +++ b/spec/support_specs/database/prevent_cross_database_modification_spec.rb @@ -99,6 +99,25 @@ RSpec.describe 'Database::PreventCrossDatabaseModification' do end end end + + context 'when executing a SELECT FOR UPDATE query' do + def run_queries + project.touch + pipeline.lock! + end + + context 'outside transaction' do + it { expect { run_queries }.not_to raise_error } + end + + context 'when data modification happens in a transaction' do + it 'raises error' do + Project.transaction do + expect { run_queries }.to raise_error /Cross-database data modification/ + end + end + end + end end context 'when CI association is modified through project' do |