summaryrefslogtreecommitdiff
path: root/spec/tasks
diff options
context:
space:
mode:
authorDrew Blessing <drew@gitlab.com>2016-03-08 16:52:48 -0600
committerDrew Blessing <drew@gitlab.com>2016-03-21 21:16:34 -0500
commit5516b6c47fa493cb792ffe501221fe397d1500ae (patch)
treec2ed9cfc7d1af9f69c35b8cd776402016fb2a50c /spec/tasks
parent0305dd98b32b5a989f2b84e0810cf5ddc14abd7f (diff)
downloadgitlab-ce-5516b6c47fa493cb792ffe501221fe397d1500ae.tar.gz
Reload the schema before restoring a database backup
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/backup_rake_spec.rb40
1 files changed, 22 insertions, 18 deletions
diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb
index 63bed2414df..320be9a0b61 100644
--- a/spec/tasks/gitlab/backup_rake_spec.rb
+++ b/spec/tasks/gitlab/backup_rake_spec.rb
@@ -3,9 +3,10 @@ require 'rake'
describe 'gitlab:app namespace rake task' do
before :all do
- Rake.application.rake_require "tasks/gitlab/task_helpers"
- Rake.application.rake_require "tasks/gitlab/backup"
- Rake.application.rake_require "tasks/gitlab/shell"
+ Rake.application.rake_require 'tasks/gitlab/task_helpers'
+ Rake.application.rake_require 'tasks/gitlab/backup'
+ Rake.application.rake_require 'tasks/gitlab/shell'
+ Rake.application.rake_require 'tasks/gitlab/db'
# empty task as env is already loaded
Rake::Task.define_task :environment
end
@@ -37,6 +38,7 @@ describe 'gitlab:app namespace rake task' do
allow(FileUtils).to receive(:mv).and_return(true)
allow(Rake::Task["gitlab:shell:setup"]).
to receive(:invoke).and_return(true)
+ ENV['force'] = 'yes'
end
let(:gitlab_version) { Gitlab::VERSION }
@@ -52,13 +54,14 @@ describe 'gitlab:app namespace rake task' do
it 'should invoke restoration on match' do
allow(YAML).to receive(:load_file).
and_return({ gitlab_version: gitlab_version })
- expect(Rake::Task["gitlab:backup:db:restore"]).to receive(:invoke)
- expect(Rake::Task["gitlab:backup:repo:restore"]).to receive(:invoke)
- expect(Rake::Task["gitlab:backup:builds:restore"]).to receive(:invoke)
- expect(Rake::Task["gitlab:backup:uploads:restore"]).to receive(:invoke)
- expect(Rake::Task["gitlab:backup:artifacts:restore"]).to receive(:invoke)
- expect(Rake::Task["gitlab:backup:lfs:restore"]).to receive(:invoke)
- expect(Rake::Task["gitlab:shell:setup"]).to receive(:invoke)
+ expect(Rake::Task['gitlab:db:drop_tables']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:db:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:repo:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:builds:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:uploads:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:artifacts:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:lfs:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:shell:setup']).to receive(:invoke)
expect { run_rake_task('gitlab:backup:restore') }.not_to raise_error
end
end
@@ -177,17 +180,18 @@ describe 'gitlab:app namespace rake task' do
end
it 'does not invoke repositories restore' do
- allow(Rake::Task["gitlab:shell:setup"]).
+ allow(Rake::Task['gitlab:shell:setup']).
to receive(:invoke).and_return(true)
allow($stdout).to receive :write
- expect(Rake::Task["gitlab:backup:db:restore"]).to receive :invoke
- expect(Rake::Task["gitlab:backup:repo:restore"]).not_to receive :invoke
- expect(Rake::Task["gitlab:backup:uploads:restore"]).not_to receive :invoke
- expect(Rake::Task["gitlab:backup:builds:restore"]).to receive :invoke
- expect(Rake::Task["gitlab:backup:artifacts:restore"]).to receive :invoke
- expect(Rake::Task["gitlab:backup:lfs:restore"]).to receive :invoke
- expect(Rake::Task["gitlab:shell:setup"]).to receive :invoke
+ expect(Rake::Task['gitlab:db:drop_tables']).to receive :invoke
+ expect(Rake::Task['gitlab:backup:db:restore']).to receive :invoke
+ expect(Rake::Task['gitlab:backup:repo:restore']).not_to receive :invoke
+ expect(Rake::Task['gitlab:backup:uploads:restore']).not_to receive :invoke
+ expect(Rake::Task['gitlab:backup:builds:restore']).to receive :invoke
+ expect(Rake::Task['gitlab:backup:artifacts:restore']).to receive :invoke
+ expect(Rake::Task['gitlab:backup:lfs:restore']).to receive :invoke
+ expect(Rake::Task['gitlab:shell:setup']).to receive :invoke
expect { run_rake_task('gitlab:backup:restore') }.not_to raise_error
end
end