X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7da8eaf51a23ab23369b6e65f0634448cc4aeb3b..aceb1f665394d84ec238d6654b5447a37c2bc3b3:/services/api/test/helpers/git_test_helper.rb diff --git a/services/api/test/helpers/git_test_helper.rb b/services/api/test/helpers/git_test_helper.rb index 170b59ee1e..cb30f68015 100644 --- a/services/api/test/helpers/git_test_helper.rb +++ b/services/api/test/helpers/git_test_helper.rb @@ -6,12 +6,12 @@ require 'fileutils' require 'tmpdir' # Commit log for "foo" repository in test.git.tar -# master is the main branch -# b1 is a branch off of master +# main is the main branch +# b1 is a branch off of main # tag1 is a tag # # 1de84a8 * b1 -# 077ba2a * master +# 077ba2a * main # 4fe459a * tag1 # 31ce37f * foo @@ -19,25 +19,25 @@ module GitTestHelper def self.included base base.setup do # Extract the test repository data into the default test - # environment's Rails.configuration.git_repositories_dir. (We + # environment's Rails.configuration.Git.Repositories. (We # don't use that config setting here, though: it doesn't seem # worth the risk of stepping on a real git repo root.) @tmpdir = Rails.root.join 'tmp', 'git' FileUtils.mkdir_p @tmpdir system("tar", "-xC", @tmpdir.to_s, "-f", "test/test.git.tar") - Rails.configuration.git_repositories_dir = "#{@tmpdir}/test" - Rails.configuration.git_internal_dir = "#{@tmpdir}/internal.git" + Rails.configuration.Git.Repositories = "#{@tmpdir}/test" + Rails.configuration.Containers.JobsAPI.GitInternalDir = "#{@tmpdir}/internal.git" end base.teardown do - FileUtils.remove_entry Commit.cache_dir_base, true + FileUtils.remove_entry CommitsHelper.cache_dir_base, true FileUtils.mkdir_p @tmpdir system("tar", "-xC", @tmpdir.to_s, "-f", "test/test.git.tar") end end def internal_tag tag - IO.read "|git --git-dir #{Rails.configuration.git_internal_dir.shellescape} log --format=format:%H -n1 #{tag.shellescape}" + IO.read "|git --git-dir #{Rails.configuration.Containers.JobsAPI.GitInternalDir.shellescape} log --format=format:%H -n1 #{tag.shellescape}" end # Intercept fetch_remote_repository and fetch from a specified url @@ -48,10 +48,10 @@ module GitTestHelper if fakeurl.is_a? Symbol fakeurl = 'file://' + repositories(fakeurl).server_path end - Commit.expects(:fetch_remote_repository).once.with do |gitdir, giturl| + CommitsHelper.expects(:fetch_remote_repository).once.with do |gitdir, giturl| if giturl == url - Commit.unstub(:fetch_remote_repository) - Commit.fetch_remote_repository gitdir, fakeurl + CommitsHelper.unstub(:fetch_remote_repository) + CommitsHelper.fetch_remote_repository gitdir, fakeurl true end end