Commit 76dadad6 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'zj-broken-storage' into 'master'

Remove broken git storage for testing

See merge request gitlab-org/gitlab-ce!22530
parents 1ad3ce92 c40b5aaa
...@@ -772,9 +772,6 @@ test: ...@@ -772,9 +772,6 @@ test:
default: default:
path: tmp/tests/repositories/ path: tmp/tests/repositories/
gitaly_address: unix:tmp/tests/gitaly/gitaly.socket gitaly_address: unix:tmp/tests/gitaly/gitaly.socket
broken:
path: tmp/tests/non-existent-repositories
gitaly_address: unix:tmp/tests/gitaly/gitaly.socket
gitaly: gitaly:
client_path: tmp/tests/gitaly client_path: tmp/tests/gitaly
......
...@@ -32,7 +32,10 @@ module Gitlab ...@@ -32,7 +32,10 @@ module Gitlab
end end
if Rails.env.test? if Rails.env.test?
storages << { name: 'test_second_storage', path: Rails.root.join('tmp', 'tests', 'second_storage').to_s } storage_path = Rails.root.join('tmp', 'tests', 'second_storage').to_s
FileUtils.mkdir(storage_path) unless File.exist?(storage_path)
storages << { name: 'test_second_storage', path: storage_path }
end end
config = { socket_path: address.sub(/\Aunix:/, ''), storage: storages } config = { socket_path: address.sub(/\Aunix:/, ''), storage: storages }
......
...@@ -26,9 +26,7 @@ describe Gitaly::Server do ...@@ -26,9 +26,7 @@ describe Gitaly::Server do
end end
end end
context 'when the storage is not readable' do context 'when the storage is not readable', :broken_storage do
let(:server) { described_class.new('broken') }
it 'returns false' do it 'returns false' do
expect(server).not_to be_readable expect(server).not_to be_readable
end end
...@@ -42,9 +40,7 @@ describe Gitaly::Server do ...@@ -42,9 +40,7 @@ describe Gitaly::Server do
end end
end end
context 'when the storage is not writeable' do context 'when the storage is not writeable', :broken_storage do
let(:server) { described_class.new('broken') }
it 'returns false' do it 'returns false' do
expect(server).not_to be_writeable expect(server).not_to be_writeable
end end
......
...@@ -70,7 +70,6 @@ module TestEnv ...@@ -70,7 +70,6 @@ module TestEnv
TMP_TEST_PATH = Rails.root.join('tmp', 'tests', '**') TMP_TEST_PATH = Rails.root.join('tmp', 'tests', '**')
REPOS_STORAGE = 'default'.freeze REPOS_STORAGE = 'default'.freeze
BROKEN_STORAGE = 'broken'.freeze
# Test environment # Test environment
# #
...@@ -159,10 +158,6 @@ module TestEnv ...@@ -159,10 +158,6 @@ module TestEnv
version: Gitlab::GitalyClient.expected_server_version, version: Gitlab::GitalyClient.expected_server_version,
task: "gitlab:gitaly:install[#{gitaly_dir},#{repos_path}]") do task: "gitlab:gitaly:install[#{gitaly_dir},#{repos_path}]") do
# Re-create config, to specify the broken storage path
storage_paths = { 'default' => repos_path, 'broken' => broken_path }
Gitlab::SetupHelper.create_gitaly_configuration(gitaly_dir, storage_paths, force: true)
start_gitaly(gitaly_dir) start_gitaly(gitaly_dir)
end end
end end
...@@ -257,10 +252,6 @@ module TestEnv ...@@ -257,10 +252,6 @@ module TestEnv
@repos_path ||= Gitlab.config.repositories.storages[REPOS_STORAGE].legacy_disk_path @repos_path ||= Gitlab.config.repositories.storages[REPOS_STORAGE].legacy_disk_path
end end
def broken_path
@broken_path ||= Gitlab.config.repositories.storages[BROKEN_STORAGE].legacy_disk_path
end
def backup_path def backup_path
Gitlab.config.backup.path Gitlab.config.backup.path
end end
......
RSpec.configure do |config| RSpec.configure do |config|
config.before(:all, :broken_storage) do
FileUtils.rm_rf Gitlab.config.repositories.storages.broken.legacy_disk_path
end
config.before(:each, :broken_storage) do config.before(:each, :broken_storage) do
allow(Gitlab::GitalyClient).to receive(:call) do allow(Gitlab::GitalyClient).to receive(:call) do
raise GRPC::Unavailable.new('Gitaly broken in this spec') raise GRPC::Unavailable.new('Gitaly broken in this spec')
......
...@@ -51,7 +51,7 @@ describe RepositoryCheck::BatchWorker do ...@@ -51,7 +51,7 @@ describe RepositoryCheck::BatchWorker do
it 'does nothing when shard is unhealthy' do it 'does nothing when shard is unhealthy' do
shard_name = 'broken' shard_name = 'broken'
create(:project, created_at: 1.week.ago, repository_storage: shard_name) create(:project, :broken_storage, created_at: 1.week.ago)
expect(subject.perform(shard_name)).to eq(nil) expect(subject.perform(shard_name)).to eq(nil)
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