diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-04-18 10:41:26 +0800 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-04-23 01:18:15 +0800 |
commit | 1a696f740176bbf03988ebd41113238d890179b0 (patch) | |
tree | b4a9f8cd8722bfcab1594f7508065dbd792393ff | |
parent | 1fe36af14ebdd75e7af0edb4aed15557b97cf690 (diff) | |
download | gitlab-ce-remove-delete-after-every-context.tar.gz |
Remove DB deletion after every test contextremove-delete-after-every-context
For tests that add data outside a transaction, developers
should be responsible for cleanup. The :delete metadata can be
used for this.
-rw-r--r-- | spec/spec_helper.rb | 3 | ||||
-rw-r--r-- | spec/support/database_cleaner.rb | 6 | ||||
-rw-r--r-- | spec/tasks/gitlab/backup_rake_spec.rb | 2 |
3 files changed, 4 insertions, 7 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 93ca0ce9f76..1100d42f529 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -242,6 +242,9 @@ RSpec.configure do |config| schema_migrate_up! Gitlab::CurrentSettings.clear_in_memory_application_settings! + + # Migrating may add data to the DB so we force a cleanup here + DatabaseCleaner.clean_with(:deletion, cache_tables: false) end config.around(:each, :nested_groups) do |example| diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index 45437364e23..b77be7adff3 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -19,14 +19,8 @@ DatabaseCleaner::ActiveRecord::Deletion.prepend(FakeInformationSchema) RSpec.configure do |config| include DbCleaner - # Ensure all sequences are reset at the start of the suite run config.before(:suite) do setup_database_cleaner - DatabaseCleaner.clean_with(:truncation) - end - - config.append_after(:context) do - DatabaseCleaner.clean_with(:deletion, cache_tables: false) end config.around(:each, :delete) do |example| diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb index bdbd39475b9..2ec1aa46362 100644 --- a/spec/tasks/gitlab/backup_rake_spec.rb +++ b/spec/tasks/gitlab/backup_rake_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'rake' -describe 'gitlab:app namespace rake task' do +describe 'gitlab:app namespace rake task', :delete do let(:enable_registry) { true } def tars_glob |