Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer (GitLab) <jacob@gitlab.com>2018-06-05 18:51:14 +0300
committerDouwe Maan <douwe@gitlab.com>2018-06-05 18:51:14 +0300
commita0808df0b627180d7773d5d13a0f64d6e7c45f5d (patch)
treecd33f1aa2b27747ff09d10d74d2606a274dba565 /spec/models
parent78d2e91b7c514c1d743294ae014f24eec7cb7d52 (diff)
Find and mark more Git disk access locations
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/merge_request_spec.rb12
-rw-r--r--spec/models/namespace_spec.rb10
-rw-r--r--spec/models/repository_spec.rb43
3 files changed, 56 insertions, 9 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 7e85a99494a..3f028b3bd5c 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -16,7 +16,11 @@ describe MergeRequest do
describe '#squash_in_progress?' do
shared_examples 'checking whether a squash is in progress' do
- let(:repo_path) { subject.source_project.repository.path }
+ let(:repo_path) do
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ subject.source_project.repository.path
+ end
+ end
let(:squash_path) { File.join(repo_path, "gitlab-worktree", "squash-#{subject.id}") }
before do
@@ -2197,7 +2201,11 @@ describe MergeRequest do
describe '#rebase_in_progress?' do
shared_examples 'checking whether a rebase is in progress' do
- let(:repo_path) { subject.source_project.repository.path }
+ let(:repo_path) do
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ subject.source_project.repository.path
+ end
+ end
let(:rebase_path) { File.join(repo_path, "gitlab-worktree", "rebase-#{subject.id}") }
before do
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 6f702d8d95e..18b01c3e6b7 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -301,12 +301,18 @@ describe Namespace do
end
def project_rugged(project)
- project.repository.rugged
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ project.repository.rugged
+ end
end
end
describe '#rm_dir', 'callback' do
- let(:repository_storage_path) { Gitlab.config.repositories.storages.default.legacy_disk_path }
+ let(:repository_storage_path) do
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ Gitlab.config.repositories.storages.default.legacy_disk_path
+ end
+ end
let(:path_in_dir) { File.join(repository_storage_path, namespace.full_path) }
let(:deleted_path) { namespace.full_path.gsub(namespace.path, "#{namespace.full_path}+#{namespace.id}+deleted") }
let(:deleted_path_in_dir) { File.join(repository_storage_path, deleted_path) }
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 0ccf55bd895..c1aa7d80c94 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -136,7 +136,10 @@ describe Repository do
before do
options = { message: 'test tag message\n',
tagger: { name: 'John Smith', email: 'john@gmail.com' } }
- repository.rugged.tags.create(annotated_tag_name, 'a48e4fc218069f68ef2e769dd8dfea3991362175', options)
+
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ repository.rugged.tags.create(annotated_tag_name, 'a48e4fc218069f68ef2e769dd8dfea3991362175', options)
+ end
double_first = double(committed_date: Time.now - 1.second)
double_last = double(committed_date: Time.now)
@@ -1048,6 +1051,13 @@ describe Repository do
let(:target_project) { project }
let(:target_repository) { target_project.repository }
+ around do |example|
+ # TODO Gitlab::Git::OperationService will be moved to gitaly-ruby and disappear from this repo
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ example.run
+ end
+ end
+
context 'when pre hooks were successful' do
before do
service = Gitlab::Git::HooksService.new
@@ -1309,6 +1319,13 @@ describe Repository do
end
describe '#update_autocrlf_option' do
+ around do |example|
+ # TODO Gitlab::Git::OperationService will be moved to gitaly-ruby and disappear from this repo
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ example.run
+ end
+ end
+
describe 'when autocrlf is not already set to :input' do
before do
repository.raw_repository.autocrlf = true
@@ -1802,7 +1819,9 @@ describe Repository do
expect(repository.branch_count).to be_an(Integer)
# NOTE: Until rugged goes away, make sure rugged and gitaly are in sync
- rugged_count = repository.raw_repository.rugged.branches.count
+ rugged_count = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ repository.raw_repository.rugged.branches.count
+ end
expect(repository.branch_count).to eq(rugged_count)
end
@@ -1813,7 +1832,9 @@ describe Repository do
expect(repository.tag_count).to be_an(Integer)
# NOTE: Until rugged goes away, make sure rugged and gitaly are in sync
- rugged_count = repository.raw_repository.rugged.tags.count
+ rugged_count = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ repository.raw_repository.rugged.tags.count
+ end
expect(repository.tag_count).to eq(rugged_count)
end
@@ -2073,7 +2094,10 @@ describe Repository do
it "attempting to call keep_around on truncated ref does not fail" do
repository.keep_around(sample_commit.id)
ref = repository.send(:keep_around_ref_name, sample_commit.id)
- path = File.join(repository.path, ref)
+
+ path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ File.join(repository.path, ref)
+ end
# Corrupt the reference
File.truncate(path, 0)
@@ -2088,6 +2112,13 @@ describe Repository do
end
describe '#update_ref' do
+ around do |example|
+ # TODO Gitlab::Git::OperationService will be moved to gitaly-ruby and disappear from this repo
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ example.run
+ end
+ end
+
it 'can create a ref' do
Gitlab::Git::OperationService.new(nil, repository.raw_repository).send(:update_ref, 'refs/heads/foobar', 'refs/heads/master', Gitlab::Git::BLANK_SHA)
@@ -2372,7 +2403,9 @@ describe Repository do
end
def create_remote_branch(remote_name, branch_name, target)
- rugged = repository.rugged
+ rugged = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ repository.rugged
+ end
rugged.references.create("refs/remotes/#{remote_name}/#{branch_name}", target.id)
end