summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-11-15 05:19:07 -0800
committerMichael Kozono <mkozono@gmail.com>2017-12-01 15:26:41 -0800
commit87529ce5823036d4b9dd9ca412643befc8e490c3 (patch)
treef6c93c6f7f46eb46a5548a5dc90a56e267ff3492 /spec/support
parent10c660be007406533e48d5e3c6485ecf210e051b (diff)
downloadgitlab-ce-87529ce5823036d4b9dd9ca412643befc8e490c3.tar.gz
Move temp table creation into the prepare job
* Hopefully fixes spec failures in which the table doesn’t exist * Decouples the background migration from the post-deploy migration, e.g. we could easily run it again even though the table is dropped when finished.
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/track_untracked_uploads_helpers.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/spec/support/track_untracked_uploads_helpers.rb b/spec/support/track_untracked_uploads_helpers.rb
index bb700bc53f1..4d4745fd7f4 100644
--- a/spec/support/track_untracked_uploads_helpers.rb
+++ b/spec/support/track_untracked_uploads_helpers.rb
@@ -4,17 +4,11 @@ module TrackUntrackedUploadsHelpers
fixture_file_upload(fixture_path)
end
- def recreate_temp_table_if_dropped
- TrackUntrackedUploads.new.ensure_temporary_tracking_table_exists
+ def ensure_temporary_tracking_table_exists
+ Gitlab::BackgroundMigration::PrepareUntrackedUploads.new.send(:ensure_temporary_tracking_table_exists)
end
- RSpec.configure do |config|
- config.after(:each, :temp_table_may_drop) do
- recreate_temp_table_if_dropped
- end
-
- config.after(:context, :temp_table_may_drop) do
- recreate_temp_table_if_dropped
- end
+ def drop_temp_table_if_exists
+ ActiveRecord::Base.connection.drop_table(:untracked_files_for_uploads) if ActiveRecord::Base.connection.table_exists?(:untracked_files_for_uploads)
end
end