diff options
Diffstat (limited to 'spec/support/helpers/seed_helper.rb')
-rw-r--r-- | spec/support/helpers/seed_helper.rb | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/spec/support/helpers/seed_helper.rb b/spec/support/helpers/seed_helper.rb deleted file mode 100644 index 9628762d46a..00000000000 --- a/spec/support/helpers/seed_helper.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -require_relative 'test_env' - -# This file is specific to specs in spec/lib/gitlab/git/ - -SEED_STORAGE_PATH = Gitlab::GitalyClient::StorageSettings.allow_disk_access { TestEnv.repos_path } -TEST_REPO_PATH = 'gitlab-git-test.git' -TEST_NORMAL_REPO_PATH = 'not-bare-repo.git' -TEST_MUTABLE_REPO_PATH = 'mutable-repo.git' -TEST_BROKEN_REPO_PATH = 'broken-repo.git' - -module SeedHelper - GITLAB_GIT_TEST_REPO_URL = File.expand_path('../gitlab-git-test.git', __dir__) - - def ensure_seeds - if File.exist?(SEED_STORAGE_PATH) - FileUtils.rm_r(SEED_STORAGE_PATH) - end - - FileUtils.mkdir_p(SEED_STORAGE_PATH) - - create_bare_seeds - create_normal_seeds - create_mutable_seeds - create_broken_seeds - end - - def create_bare_seeds - system(git_env, *%W(#{Gitlab.config.git.bin_path} clone --bare #{GITLAB_GIT_TEST_REPO_URL}), - 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 --bare #{TEST_REPO_PATH} #{TEST_MUTABLE_REPO_PATH}), - chdir: SEED_STORAGE_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: 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(SEED_STORAGE_PATH, TEST_BROKEN_REPO_PATH, 'refs') - - FileUtils.rm_r(refs_path) - end -end |