diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-09 15:08:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-09 15:08:37 +0300 |
commit | 1faea1c6a0464e44dca4477fb31846938c2ad871 (patch) | |
tree | 49e1efd28dc28a14e68b7c3510621499f1a5141c /spec/support/database | |
parent | c2de38f36d2fb75a17ce161fa69f2b8a5e670f3e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/database')
-rw-r--r-- | spec/support/database/auto_explain.rb | 15 | ||||
-rw-r--r-- | spec/support/database/prevent_cross_database_modification.rb | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/spec/support/database/auto_explain.rb b/spec/support/database/auto_explain.rb index 799457034a1..108d88e37b9 100644 --- a/spec/support/database/auto_explain.rb +++ b/spec/support/database/auto_explain.rb @@ -115,16 +115,11 @@ module AutoExplain private def record_auto_explain?(connection) - return false unless ENV['CI'] - return false if ENV['CI_JOB_NAME_SLUG'] == 'db-migrate-non-superuser' - return false if connection.database_version.to_s[0..1].to_i < 14 - return false if connection.select_one('SHOW is_superuser')['is_superuser'] != 'on' - - # This condition matches the pipeline rules for if-merge-request-labels-record-queries - return true if ENV['CI_MERGE_REQUEST_LABELS']&.include?('pipeline:record-queries') - - # This condition matches the pipeline rules for if-default-branch-refs - ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] && !ENV['CI_MERGE_REQUEST_IID'] + ENV['CI'] \ + && ENV['CI_MERGE_REQUEST_LABELS']&.include?('pipeline:record-queries') \ + && ENV['CI_JOB_NAME_SLUG'] != 'db-migrate-non-superuser' \ + && connection.database_version.to_s[0..1].to_i >= 14 \ + && connection.select_one('SHOW is_superuser')['is_superuser'] == 'on' end end end diff --git a/spec/support/database/prevent_cross_database_modification.rb b/spec/support/database/prevent_cross_database_modification.rb index cd0cbe733d1..77fa7feacd4 100644 --- a/spec/support/database/prevent_cross_database_modification.rb +++ b/spec/support/database/prevent_cross_database_modification.rb @@ -25,7 +25,7 @@ RSpec.configure do |config| end # Reset after execution to preferred state - config.after do |example_file| + config.after do |_example_file| ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.suppress_in_rspec = true ::ApplicationRecord.gitlab_transactions_stack.clear |