summaryrefslogtreecommitdiff
path: root/spec/tasks/gitlab/lfs/migrate_rake_spec.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-04-04 20:04:39 +0100
committerFilipa Lacerda <filipa@gitlab.com>2018-04-04 20:04:39 +0100
commit85b45ce94de94a85bb341d2978f1471a21b9a0ff (patch)
treeab65c6cfefc07fd2a65c20e15d7fda98047886bb /spec/tasks/gitlab/lfs/migrate_rake_spec.rb
parentdd3b1526af1675f7686f189ec41b8d919b6835a2 (diff)
parentcb5bb4dbc67c5dd43bb7b27faf79ca79f8ae3e1f (diff)
downloadgitlab-ce-85b45ce94de94a85bb341d2978f1471a21b9a0ff.tar.gz
[ci skip] Merge branch 'master' into 44427-state-management-with-vuex
* master: (544 commits) Bulk deleting refs is handled by Gitaly by default Allow assigning and filtering issuables by ancestor group labels Fix links to subdirectories of a directory with a plus character in its path Add banzai filter to detect commit message trailers and properly link the users Render MR commit SHA instead "diffs" when viable Fix a transient failure by removing unneeded expectations Revert changelog entry for removed feature Revert "Allow CI/CD Jobs being grouped on version strings" Add support for Sidekiq JSON logging Resolve "Protected branches count is wrong when a wildcard includes several protected branches" Remove unused form for admin application settings Use standard codequality job Resolve "Allow the configuration of a project's merge method via the API" Move the rest of application settings to expandable blocks [Rails5] Rename `sort` methods to `sort_by_attribute` Add better LDAP connection handling Updated components to PascalCase Handle invalid params when trying update_username Move network related app settings to expandable blocks [Rails5] Update Gemfile.rails5.lock [ci skip] ...
Diffstat (limited to 'spec/tasks/gitlab/lfs/migrate_rake_spec.rb')
-rw-r--r--spec/tasks/gitlab/lfs/migrate_rake_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/lfs/migrate_rake_spec.rb b/spec/tasks/gitlab/lfs/migrate_rake_spec.rb
new file mode 100644
index 00000000000..66d1a192a96
--- /dev/null
+++ b/spec/tasks/gitlab/lfs/migrate_rake_spec.rb
@@ -0,0 +1,37 @@
+require 'rake_helper'
+
+describe 'gitlab:lfs namespace rake task' do
+ before :all do
+ Rake.application.rake_require 'tasks/gitlab/lfs/migrate'
+ end
+
+ describe 'migrate' do
+ let(:local) { ObjectStorage::Store::LOCAL }
+ let(:remote) { ObjectStorage::Store::REMOTE }
+ let!(:lfs_object) { create(:lfs_object, :with_file, file_store: local) }
+
+ def lfs_migrate
+ run_rake_task('gitlab:lfs:migrate')
+ end
+
+ context 'object storage disabled' do
+ before do
+ stub_lfs_object_storage(enabled: false)
+ end
+
+ it "doesn't migrate files" do
+ expect { lfs_migrate }.not_to change { lfs_object.reload.file_store }
+ end
+ end
+
+ context 'object storage enabled' do
+ before do
+ stub_lfs_object_storage
+ end
+
+ it 'migrates local file to object storage' do
+ expect { lfs_migrate }.to change { lfs_object.reload.file_store }.from(local).to(remote)
+ end
+ end
+ end
+end