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:
authorMichael Kozono <mkozono@gmail.com>2017-11-10 04:21:32 +0300
committerMichael Kozono <mkozono@gmail.com>2017-11-17 03:51:39 +0300
commit24ffbc433649fd34ff6632228a5549cf9a8886d5 (patch)
tree7d2b912d99806e7b862290ed438d9dd35ecf4fc6
parent07604c83cc764c4ec33eecb42e49d1fb97695c29 (diff)
Remove unnecessary clearing
Since duplicate inserts are now ignored.
-rw-r--r--lib/gitlab/background_migration/prepare_untracked_uploads.rb5
-rw-r--r--spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb4
2 files changed, 2 insertions, 7 deletions
diff --git a/lib/gitlab/background_migration/prepare_untracked_uploads.rb b/lib/gitlab/background_migration/prepare_untracked_uploads.rb
index 6a7fef18e53..11978b73a8a 100644
--- a/lib/gitlab/background_migration/prepare_untracked_uploads.rb
+++ b/lib/gitlab/background_migration/prepare_untracked_uploads.rb
@@ -17,7 +17,6 @@ module Gitlab
def perform
return unless migrate?
- clear_untracked_file_paths
store_untracked_file_paths
schedule_populate_untracked_uploads_jobs
end
@@ -28,10 +27,6 @@ module Gitlab
UntrackedFile.table_exists?
end
- def clear_untracked_file_paths
- UntrackedFile.delete_all
- end
-
def store_untracked_file_paths
return unless Dir.exist?(UPLOAD_DIR)
diff --git a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb
index 3d2504f84a1..cf1cad15c9a 100644
--- a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb
+++ b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb
@@ -68,14 +68,14 @@ describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :migration, :side
# E.g. from a previous failed run of this background migration
context 'when there is existing data in untracked_files_for_uploads' do
before do
- untracked_files_for_uploads.create(path: '/foo/bar.jpg')
+ described_class.new.perform
end
it 'does not error or produce duplicates of existing data' do
Sidekiq::Testing.fake! do
expect do
described_class.new.perform
- end.to change { untracked_files_for_uploads.count }.from(1).to(5)
+ end.not_to change { untracked_files_for_uploads.count }.from(5)
end
end
end