summaryrefslogtreecommitdiff
path: root/spec/tasks/gitlab/backup_rake_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/tasks/gitlab/backup_rake_spec.rb')
-rw-r--r--spec/tasks/gitlab/backup_rake_spec.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb
index 10458966cb9..daea0c6bb37 100644
--- a/spec/tasks/gitlab/backup_rake_spec.rb
+++ b/spec/tasks/gitlab/backup_rake_spec.rb
@@ -81,6 +81,10 @@ describe 'gitlab:app namespace rake task' do
end # backup_restore task
describe 'backup' do
+ before(:all) do
+ ENV['force'] = 'yes'
+ end
+
def tars_glob
Dir.glob(File.join(Gitlab.config.backup.path, '*_gitlab_backup.tar'))
end
@@ -88,6 +92,9 @@ describe 'gitlab:app namespace rake task' do
def create_backup
FileUtils.rm tars_glob
+ # This reconnect makes our project fixture disappear, breaking the restore. Stub it out.
+ allow(ActiveRecord::Base.connection).to receive(:reconnect!)
+
# Redirect STDOUT and run the rake task
orig_stdout = $stdout
$stdout = StringIO.new
@@ -109,7 +116,7 @@ describe 'gitlab:app namespace rake task' do
end
describe 'backup creation and deletion using custom_hooks' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user_backup_path) { "repositories/#{project.path_with_namespace}" }
before(:each) do
@@ -119,9 +126,6 @@ describe 'gitlab:app namespace rake task' do
FileUtils.mkdir_p(path)
FileUtils.touch(File.join(path, "dummy.txt"))
- # We need to use the full path instead of the relative one
- allow(Gitlab.config.gitlab_shell).to receive(:path).and_return(File.expand_path(Gitlab.config.gitlab_shell.path, Rails.root.to_s))
-
ENV["SKIP"] = "db"
create_backup
end
@@ -220,15 +224,15 @@ describe 'gitlab:app namespace rake task' do
end
context 'multiple repository storages' do
- let(:project_a) { create(:project, repository_storage: 'default') }
- let(:project_b) { create(:project, repository_storage: 'custom') }
+ let(:project_a) { create(:project, :repository, repository_storage: 'default') }
+ let(:project_b) { create(:project, :repository, repository_storage: 'custom') }
before do
FileUtils.mkdir('tmp/tests/default_storage')
FileUtils.mkdir('tmp/tests/custom_storage')
storages = {
- 'default' => { 'path' => 'tmp/tests/default_storage' },
- 'custom' => { 'path' => 'tmp/tests/custom_storage' }
+ 'default' => { 'path' => Settings.absolute('tmp/tests/default_storage') },
+ 'custom' => { 'path' => Settings.absolute('tmp/tests/custom_storage') }
}
allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)