diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-31 18:10:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-31 18:10:29 +0300 |
commit | d7918f34666a538be467cb9db04630960e3659d3 (patch) | |
tree | a1e937ec7569d081a4382ca8d2ca9f6968e0a38f /spec/support_specs/database | |
parent | a9ae162270049d3a183024e0b1f1626dbe14e847 (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_joins_spec.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/support_specs/database/prevent_cross_joins_spec.rb b/spec/support_specs/database/prevent_cross_joins_spec.rb index b26b862b34b..e9a95fe77a5 100644 --- a/spec/support_specs/database/prevent_cross_joins_spec.rb +++ b/spec/support_specs/database/prevent_cross_joins_spec.rb @@ -24,9 +24,13 @@ RSpec.describe Database::PreventCrossJoins do context 'when allow_cross_joins_across_databases is used' do it 'does not raise exception' do - Gitlab::Database.allow_cross_joins_across_databases(url: 'http://issue-url') + expect { main_and_ci_query_allowlisted }.not_to raise_error + end + end - expect { main_and_ci_query }.not_to raise_error + context 'when allow_cross_joins_across_databases is used' do + it 'does not raise exception' do + expect { main_and_ci_query_allowlist_nested }.not_to raise_error end end end @@ -34,6 +38,20 @@ RSpec.describe Database::PreventCrossJoins do private + def main_and_ci_query_allowlisted + Gitlab::Database.allow_cross_joins_across_databases(url: 'http://issue-url') do + main_and_ci_query + end + end + + def main_and_ci_query_allowlist_nested + Gitlab::Database.allow_cross_joins_across_databases(url: 'http://issue-url') do + main_and_ci_query_allowlisted + + main_and_ci_query + end + end + def main_only_query Issue.joins(:project).last end |