diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-12 12:09:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-12 12:09:35 +0300 |
commit | 91e8c3a6efea1d805cfa86e7ade9a9628344cf89 (patch) | |
tree | 47a870df1ac60bd105f3eaaab11a40ed331934a1 /spec/support/database | |
parent | e7ab7aaa8de457cea8385f2f42220b21dd78375f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/database')
-rw-r--r-- | spec/support/database/cross-join-allowlist.yml | 5 | ||||
-rw-r--r-- | spec/support/database/prevent_cross_database_modification.rb | 13 |
2 files changed, 12 insertions, 6 deletions
diff --git a/spec/support/database/cross-join-allowlist.yml b/spec/support/database/cross-join-allowlist.yml index 87a91c80671..af5d9b1efb3 100644 --- a/spec/support/database/cross-join-allowlist.yml +++ b/spec/support/database/cross-join-allowlist.yml @@ -41,8 +41,8 @@ - "./ee/spec/services/ee/merge_requests/create_pipeline_service_spec.rb" - "./ee/spec/services/ee/merge_requests/refresh_service_spec.rb" - "./ee/spec/workers/scan_security_report_secrets_worker_spec.rb" -- "./spec/controllers/admin/runners_controller_spec.rb" - "./spec/controllers/groups/settings/ci_cd_controller_spec.rb" +- "./spec/controllers/admin/runners_controller_spec.rb" - "./spec/controllers/projects/merge_requests_controller_spec.rb" - "./spec/controllers/projects/settings/ci_cd_controller_spec.rb" - "./spec/features/admin/admin_runners_spec.rb" @@ -56,7 +56,6 @@ - "./spec/finders/ci/pipelines_for_merge_request_finder_spec.rb" - "./spec/finders/ci/runners_finder_spec.rb" - "./spec/frontend/fixtures/runner.rb" -- "./spec/graphql/mutations/ci/runner/delete_spec.rb" - "./spec/graphql/resolvers/ci/group_runners_resolver_spec.rb" - "./spec/graphql/resolvers/merge_request_pipelines_resolver_spec.rb" - "./spec/lib/api/entities/package_spec.rb" @@ -71,13 +70,11 @@ - "./spec/models/ci/job_artifact_spec.rb" - "./spec/models/ci/pipeline_spec.rb" - "./spec/models/ci/runner_spec.rb" -- "./spec/models/clusters/applications/runner_spec.rb" - "./spec/models/deployment_spec.rb" - "./spec/models/environment_spec.rb" - "./spec/models/merge_request_spec.rb" - "./spec/models/project_spec.rb" - "./spec/models/user_spec.rb" -- "./spec/presenters/ci/build_runner_presenter_spec.rb" - "./spec/presenters/ci/pipeline_presenter_spec.rb" - "./spec/presenters/packages/detail/package_presenter_spec.rb" - "./spec/requests/api/ci/runner/runners_post_spec.rb" diff --git a/spec/support/database/prevent_cross_database_modification.rb b/spec/support/database/prevent_cross_database_modification.rb index 744e082de64..ade815dd627 100644 --- a/spec/support/database/prevent_cross_database_modification.rb +++ b/spec/support/database/prevent_cross_database_modification.rb @@ -79,8 +79,17 @@ module Database return if cross_database_context[:transaction_depth_by_db].values.all?(&:zero?) - parsed_query = PgQuery.parse(sql) - tables = sql.downcase.include?(' for update') ? parsed_query.tables : parsed_query.dml_tables + # PgQuery might fail in some cases due to limited nesting: + # https://github.com/pganalyze/pg_query/issues/209 + # + # Also, we disable GC while parsing because of https://github.com/pganalyze/pg_query/issues/226 + begin + GC.disable + parsed_query = PgQuery.parse(sql) + tables = sql.downcase.include?(' for update') ? parsed_query.tables : parsed_query.dml_tables + ensure + GC.enable + end return if tables.empty? |