Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-19 21:10:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-19 21:10:06 +0300
commitb45b4fa37b88501538b4139ef9f2f2777414d630 (patch)
treec3de025a8db9ad2cfd056795bbded5054ad15261 /spec/support/database
parent2b5469a93eb16d5a24c02105e2251e65a75ba915 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/database')
-rw-r--r--spec/support/database/multiple_databases.rb38
1 files changed, 2 insertions, 36 deletions
diff --git a/spec/support/database/multiple_databases.rb b/spec/support/database/multiple_databases.rb
index 25c3b6e74ce..96bdab5171d 100644
--- a/spec/support/database/multiple_databases.rb
+++ b/spec/support/database/multiple_databases.rb
@@ -2,15 +2,6 @@
module Database
module MultipleDatabases
- def run_and_cleanup(example)
- # Each example may call `migrate!`, so we must ensure we are migrated down every time
- schema_migrate_down!
-
- example.run
-
- delete_from_all_tables!(except: deletion_except_tables)
- end
-
def skip_if_multiple_databases_not_setup
skip 'Skipping because multiple databases not set up' unless Gitlab::Database.has_config?(:ci)
end
@@ -31,21 +22,6 @@ module Database
model.establish_connection(new_db_config)
end
- def ensure_schema_and_empty_tables
- # Ensure all schemas for both databases are migrated back
- Gitlab::Database.database_base_models.each do |_, base_model|
- with_reestablished_active_record_base do
- reconfigure_db_connection(
- model: ActiveRecord::Base,
- config_model: base_model
- )
-
- schema_migrate_up!
- delete_from_all_tables!(except: deletion_except_tables)
- end
- end
- end
-
# The usage of this method switches temporarily used `connection_handler`
# allowing full manipulation of ActiveRecord::Base connections without
# having side effects like:
@@ -133,15 +109,7 @@ RSpec.configure do |config|
end
end
- config.append_after(:context, :migration) do
- break if recreate_databases_and_seed_if_needed
-
- ensure_schema_and_empty_tables
- end
-
config.around(:each, :migration) do |example|
- self.class.use_transactional_tests = false
-
migration_schema = example.metadata[:migration]
migration_schema = :gitlab_main if migration_schema == true
base_model = Gitlab::Database.schemas_to_base_models.fetch(migration_schema).first
@@ -154,13 +122,11 @@ RSpec.configure do |config|
config_model: base_model
)
- run_and_cleanup(example)
+ example.run
end
else
- run_and_cleanup(example)
+ example.run
end
-
- self.class.use_transactional_tests = true
end
end