Allow backup tests to run locally

parent 1904c80f
...@@ -81,6 +81,10 @@ describe 'gitlab:app namespace rake task' do ...@@ -81,6 +81,10 @@ describe 'gitlab:app namespace rake task' do
end # backup_restore task end # backup_restore task
describe 'backup' do describe 'backup' do
before(:all) do
ENV['force'] = 'yes'
end
def tars_glob def tars_glob
Dir.glob(File.join(Gitlab.config.backup.path, '*_gitlab_backup.tar')) Dir.glob(File.join(Gitlab.config.backup.path, '*_gitlab_backup.tar'))
end end
...@@ -88,6 +92,9 @@ describe 'gitlab:app namespace rake task' do ...@@ -88,6 +92,9 @@ describe 'gitlab:app namespace rake task' do
def create_backup def create_backup
FileUtils.rm tars_glob 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 # Redirect STDOUT and run the rake task
orig_stdout = $stdout orig_stdout = $stdout
$stdout = StringIO.new $stdout = StringIO.new
...@@ -119,9 +126,6 @@ describe 'gitlab:app namespace rake task' do ...@@ -119,9 +126,6 @@ describe 'gitlab:app namespace rake task' do
FileUtils.mkdir_p(path) FileUtils.mkdir_p(path)
FileUtils.touch(File.join(path, "dummy.txt")) 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" ENV["SKIP"] = "db"
create_backup create_backup
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment