diff options
author | Robert Speicher <robert@gitlab.com> | 2017-04-05 17:22:45 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-04-05 17:22:45 +0000 |
commit | ebdfda69bf8934ee8322e9d863872c5bcc379bcc (patch) | |
tree | bd32888dbfa047343e69ce4ce4667c50652fc009 /spec/support | |
parent | fec40d78a799a9cf0f71868053493ce6d34ebbce (diff) | |
parent | 56cf0274a00ee4f2e21d6b1d0a41ea1642a1268f (diff) | |
download | gitlab-ce-ebdfda69bf8934ee8322e9d863872c5bcc379bcc.tar.gz |
Merge branch 'gitaly-refs' into 'master'
Implement Gitaly refs client
See merge request !9291
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/matchers/gitaly_matchers.rb | 2 | ||||
-rw-r--r-- | spec/support/seed_helper.rb | 36 |
2 files changed, 22 insertions, 16 deletions
diff --git a/spec/support/matchers/gitaly_matchers.rb b/spec/support/matchers/gitaly_matchers.rb index d7a53820684..65dbc01f6e4 100644 --- a/spec/support/matchers/gitaly_matchers.rb +++ b/spec/support/matchers/gitaly_matchers.rb @@ -1,3 +1,3 @@ -RSpec::Matchers.define :post_receive_request_with_repo_path do |path| +RSpec::Matchers.define :gitaly_request_with_repo_path do |path| match { |actual| actual.repository.path == path } end diff --git a/spec/support/seed_helper.rb b/spec/support/seed_helper.rb index f55fee28ff9..47b5f556e66 100644 --- a/spec/support/seed_helper.rb +++ b/spec/support/seed_helper.rb @@ -1,20 +1,22 @@ +require_relative 'test_env' + # This file is specific to specs in spec/lib/gitlab/git/ -SEED_REPOSITORY_PATH = File.expand_path('../../tmp/repositories', __dir__) -TEST_REPO_PATH = File.join(SEED_REPOSITORY_PATH, 'gitlab-git-test.git') -TEST_NORMAL_REPO_PATH = File.join(SEED_REPOSITORY_PATH, "not-bare-repo.git") -TEST_MUTABLE_REPO_PATH = File.join(SEED_REPOSITORY_PATH, "mutable-repo.git") -TEST_BROKEN_REPO_PATH = File.join(SEED_REPOSITORY_PATH, "broken-repo.git") +SEED_STORAGE_PATH = TestEnv.repos_path +TEST_REPO_PATH = 'gitlab-git-test.git'.freeze +TEST_NORMAL_REPO_PATH = 'not-bare-repo.git'.freeze +TEST_MUTABLE_REPO_PATH = 'mutable-repo.git'.freeze +TEST_BROKEN_REPO_PATH = 'broken-repo.git'.freeze module SeedHelper GITLAB_GIT_TEST_REPO_URL = ENV.fetch('GITLAB_GIT_TEST_REPO_URL', 'https://gitlab.com/gitlab-org/gitlab-git-test.git').freeze def ensure_seeds - if File.exist?(SEED_REPOSITORY_PATH) - FileUtils.rm_r(SEED_REPOSITORY_PATH) + if File.exist?(SEED_STORAGE_PATH) + FileUtils.rm_r(SEED_STORAGE_PATH) end - FileUtils.mkdir_p(SEED_REPOSITORY_PATH) + FileUtils.mkdir_p(SEED_STORAGE_PATH) create_bare_seeds create_normal_seeds @@ -26,41 +28,45 @@ module SeedHelper def create_bare_seeds system(git_env, *%W(#{Gitlab.config.git.bin_path} clone --bare #{GITLAB_GIT_TEST_REPO_URL}), - chdir: SEED_REPOSITORY_PATH, + chdir: SEED_STORAGE_PATH, out: '/dev/null', err: '/dev/null') end def create_normal_seeds system(git_env, *%W(#{Gitlab.config.git.bin_path} clone #{TEST_REPO_PATH} #{TEST_NORMAL_REPO_PATH}), + chdir: SEED_STORAGE_PATH, out: '/dev/null', err: '/dev/null') end def create_mutable_seeds system(git_env, *%W(#{Gitlab.config.git.bin_path} clone #{TEST_REPO_PATH} #{TEST_MUTABLE_REPO_PATH}), + chdir: SEED_STORAGE_PATH, out: '/dev/null', err: '/dev/null') - system(git_env, *%w(git branch -t feature origin/feature), - chdir: TEST_MUTABLE_REPO_PATH, out: '/dev/null', err: '/dev/null') + mutable_repo_full_path = File.join(SEED_STORAGE_PATH, TEST_MUTABLE_REPO_PATH) + system(git_env, *%W(#{Gitlab.config.git.bin_path} branch -t feature origin/feature), + chdir: mutable_repo_full_path, out: '/dev/null', err: '/dev/null') system(git_env, *%W(#{Gitlab.config.git.bin_path} remote add expendable #{GITLAB_GIT_TEST_REPO_URL}), - chdir: TEST_MUTABLE_REPO_PATH, out: '/dev/null', err: '/dev/null') + chdir: mutable_repo_full_path, out: '/dev/null', err: '/dev/null') end def create_broken_seeds system(git_env, *%W(#{Gitlab.config.git.bin_path} clone --bare #{TEST_REPO_PATH} #{TEST_BROKEN_REPO_PATH}), + chdir: SEED_STORAGE_PATH, out: '/dev/null', err: '/dev/null') - refs_path = File.join(TEST_BROKEN_REPO_PATH, 'refs') + refs_path = File.join(SEED_STORAGE_PATH, TEST_BROKEN_REPO_PATH, 'refs') FileUtils.rm_r(refs_path) end def create_git_attributes - dir = File.join(SEED_REPOSITORY_PATH, 'with-git-attributes.git', 'info') + dir = File.join(SEED_STORAGE_PATH, 'with-git-attributes.git', 'info') FileUtils.mkdir_p(dir) @@ -85,7 +91,7 @@ bla/bla.txt end def create_invalid_git_attributes - dir = File.join(SEED_REPOSITORY_PATH, 'with-invalid-git-attributes.git', 'info') + dir = File.join(SEED_STORAGE_PATH, 'with-invalid-git-attributes.git', 'info') FileUtils.mkdir_p(dir) |