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
path: root/spec/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-04-04 12:20:19 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-04-04 12:20:19 +0300
commitc353426650877956bf2db3111f9964f68e5940f6 (patch)
tree43ba7e90110e742bd14c8c417254e6e104f497f1 /spec/lib
parent9dd330576ac374cd7ec7e97863e0b5228dfd3205 (diff)
parentddfc661f794ca02654853a9e223b9a5f3fb983ab (diff)
Merge branch 'fix/use-shard-name-in-gitlab-projects-instead-of-shard-path' into 'master'
Use shard name in Git::GitlabProjects instead of shard path Closes gitaly#1110 See merge request gitlab-org/gitlab-ce!18015
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/bitbucket_import/importer_spec.rb2
-rw-r--r--spec/lib/gitlab/git/gitlab_projects_spec.rb12
-rw-r--r--spec/lib/gitlab/github_import/importer/repository_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/shell_spec.rb14
4 files changed, 18 insertions, 12 deletions
diff --git a/spec/lib/gitlab/bitbucket_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_import/importer_spec.rb
index a6a1d9e619f..c63120b0b29 100644
--- a/spec/lib/gitlab/bitbucket_import/importer_spec.rb
+++ b/spec/lib/gitlab/bitbucket_import/importer_spec.rb
@@ -137,7 +137,7 @@ describe Gitlab::BitbucketImport::Importer do
it 'imports to the project disk_path' do
expect(project.wiki).to receive(:repository_exists?) { false }
expect(importer.gitlab_shell).to receive(:import_repository).with(
- project.repository_storage_path,
+ project.repository_storage,
project.wiki.disk_path,
project.import_url + '/wiki'
)
diff --git a/spec/lib/gitlab/git/gitlab_projects_spec.rb b/spec/lib/gitlab/git/gitlab_projects_spec.rb
index dfccc15a4f3..8b715d717c1 100644
--- a/spec/lib/gitlab/git/gitlab_projects_spec.rb
+++ b/spec/lib/gitlab/git/gitlab_projects_spec.rb
@@ -16,7 +16,7 @@ describe Gitlab::Git::GitlabProjects do
let(:tmp_repos_path) { TestEnv.repos_path }
let(:repo_name) { project.disk_path + '.git' }
let(:tmp_repo_path) { File.join(tmp_repos_path, repo_name) }
- let(:gl_projects) { build_gitlab_projects(tmp_repos_path, repo_name) }
+ let(:gl_projects) { build_gitlab_projects(TestEnv::REPOS_STORAGE, repo_name) }
describe '#initialize' do
it { expect(gl_projects.shard_path).to eq(tmp_repos_path) }
@@ -223,11 +223,12 @@ describe Gitlab::Git::GitlabProjects do
end
describe '#fork_repository' do
+ let(:dest_repos) { TestEnv::REPOS_STORAGE }
let(:dest_repos_path) { tmp_repos_path }
let(:dest_repo_name) { File.join('@hashed', 'aa', 'bb', 'xyz.git') }
let(:dest_repo) { File.join(dest_repos_path, dest_repo_name) }
- subject { gl_projects.fork_repository(dest_repos_path, dest_repo_name) }
+ subject { gl_projects.fork_repository(dest_repos, dest_repo_name) }
before do
FileUtils.mkdir_p(dest_repos_path)
@@ -268,7 +269,12 @@ describe Gitlab::Git::GitlabProjects do
# that is not very straight-forward so I'm leaving this test here for now till
# https://gitlab.com/gitlab-org/gitlab-ce/issues/41393 is fixed.
context 'different storages' do
- let(:dest_repos_path) { File.join(File.dirname(tmp_repos_path), 'alternative') }
+ let(:dest_repos) { 'alternative' }
+ let(:dest_repos_path) { File.join(File.dirname(tmp_repos_path), dest_repos) }
+
+ before do
+ stub_storage_settings(dest_repos => { 'path' => dest_repos_path })
+ end
it 'forks the repo' do
is_expected.to be_truthy
diff --git a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
index 1f0f1fdd7da..879b1d9fb0f 100644
--- a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
@@ -9,7 +9,7 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do
:project,
import_url: 'foo.git',
import_source: 'foo/bar',
- repository_storage_path: 'foo',
+ repository_storage: 'foo',
disk_path: 'foo',
repository: repository,
create_wiki: true
diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb
index ea5ce58e34b..7ff2c0639ec 100644
--- a/spec/lib/gitlab/shell_spec.rb
+++ b/spec/lib/gitlab/shell_spec.rb
@@ -14,7 +14,7 @@ describe Gitlab::Shell do
allow(Project).to receive(:find).and_return(project)
allow(gitlab_shell).to receive(:gitlab_projects)
- .with(project.repository_storage_path, project.disk_path + '.git')
+ .with(project.repository_storage, project.disk_path + '.git')
.and_return(gitlab_projects)
end
@@ -487,21 +487,21 @@ describe Gitlab::Shell do
describe '#fork_repository' do
subject do
gitlab_shell.fork_repository(
- project.repository_storage_path,
+ project.repository_storage,
project.disk_path,
- 'new/storage',
+ 'nfs-file05',
'fork/path'
)
end
it 'returns true when the command succeeds' do
- expect(gitlab_projects).to receive(:fork_repository).with('new/storage', 'fork/path.git') { true }
+ expect(gitlab_projects).to receive(:fork_repository).with('nfs-file05', 'fork/path.git') { true }
is_expected.to be_truthy
end
it 'return false when the command fails' do
- expect(gitlab_projects).to receive(:fork_repository).with('new/storage', 'fork/path.git') { false }
+ expect(gitlab_projects).to receive(:fork_repository).with('nfs-file05', 'fork/path.git') { false }
is_expected.to be_falsy
end
@@ -661,7 +661,7 @@ describe Gitlab::Shell do
it 'returns true when the command succeeds' do
expect(gitlab_projects).to receive(:import_project).with(import_url, timeout) { true }
- result = gitlab_shell.import_repository(project.repository_storage_path, project.disk_path, import_url)
+ result = gitlab_shell.import_repository(project.repository_storage, project.disk_path, import_url)
expect(result).to be_truthy
end
@@ -671,7 +671,7 @@ describe Gitlab::Shell do
expect(gitlab_projects).to receive(:import_project) { false }
expect do
- gitlab_shell.import_repository(project.repository_storage_path, project.disk_path, import_url)
+ gitlab_shell.import_repository(project.repository_storage, project.disk_path, import_url)
end.to raise_error(Gitlab::Shell::Error, "error")
end
end