Commit 9ce6dde8 authored by James Fargher's avatar James Fargher

Create a repository to backup in backup.rake tests

These tests are assuming that a "repositories" directory will be created
even if there were no repositories to backup. This is an unrealistic
situation.
parent d96fb2c4
...@@ -105,6 +105,8 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do ...@@ -105,6 +105,8 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
before do before do
# We only need a backup of the repositories for this test # We only need a backup of the repositories for this test
stub_env('SKIP', 'db,uploads,builds,artifacts,lfs,registry') stub_env('SKIP', 'db,uploads,builds,artifacts,lfs,registry')
create(:project, :repository)
end end
it 'removes stale data' do it 'removes stale data' do
...@@ -169,8 +171,9 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do ...@@ -169,8 +171,9 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
allow(ActiveRecord::Base.connection).to receive(:reconnect!) allow(ActiveRecord::Base.connection).to receive(:reconnect!)
end end
let!(:project) { create(:project, :repository) }
describe 'backup creation and deletion using custom_hooks' do describe 'backup creation and deletion using custom_hooks' do
let(:project) { create(:project, :repository) }
let(:user_backup_path) { "repositories/#{project.disk_path}" } let(:user_backup_path) { "repositories/#{project.disk_path}" }
before do before do
...@@ -399,6 +402,8 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do ...@@ -399,6 +402,8 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
describe "Skipping items" do describe "Skipping items" do
before do before do
stub_env('SKIP', 'repositories,uploads') stub_env('SKIP', 'repositories,uploads')
create(:project, :repository)
end end
it "does not contain skipped item" do it "does not contain skipped item" do
...@@ -441,6 +446,8 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do ...@@ -441,6 +446,8 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
describe 'skipping tar archive creation' do describe 'skipping tar archive creation' do
before do before do
stub_env('SKIP', 'tar') stub_env('SKIP', 'tar')
create(:project, :repository)
end end
it 'created files with backup content and no tar archive' do it 'created files with backup content and no tar archive' do
......
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