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:
authorGitalyBot <gitalybot@zjvandeweg.nl>2019-06-25 17:45:51 +0300
committerBob Van Landuyt <bob@gitlab.com>2019-06-25 17:45:51 +0300
commite7b54b9cb8c494f97a48e170696e5d56065aea31 (patch)
treee378d00ddfa89081379e2b7e9ab12d4b7c10a13e /spec/lib/gitlab/git/repository_spec.rb
parentd6c7d4c48db51fdc3eb479e53d40ce4358695218 (diff)
Fix broken worktree test
The setup was wrong, and due to Gitaly being a bit more strict it had to match up. The test is now accurate and passing again.
Diffstat (limited to 'spec/lib/gitlab/git/repository_spec.rb')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index e72fb9c6fbc..cceeae8afe6 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -2038,24 +2038,24 @@ describe Gitlab::Git::Repository, :seed_helper do
end
describe '#clean_stale_repository_files' do
- let(:worktree_path) { File.join(repository_path, 'worktrees', 'delete-me') }
+ let(:worktree_id) { 'rebase-1' }
+ let(:gitlab_worktree_path) { File.join(repository_path, 'gitlab-worktree', worktree_id) }
+ let(:admin_dir) { File.join(repository_path, 'worktrees') }
it 'cleans up the files' do
- create_worktree = %W[git -C #{repository_path} worktree add --detach #{worktree_path} master]
+ create_worktree = %W[git -C #{repository_path} worktree add --detach #{gitlab_worktree_path} master]
raise 'preparation failed' unless system(*create_worktree, err: '/dev/null')
- FileUtils.touch(worktree_path, mtime: Time.now - 8.hours)
+ FileUtils.touch(gitlab_worktree_path, mtime: Time.now - 8.hours)
# git rev-list --all will fail in git 2.16 if HEAD is pointing to a non-existent object,
# but the HEAD must be 40 characters long or git will ignore it.
- File.write(File.join(worktree_path, 'HEAD'), Gitlab::Git::BLANK_SHA)
-
- # git 2.16 fails with "fatal: bad object HEAD"
- expect(rev_list_all).to be false
+ File.write(File.join(admin_dir, worktree_id, 'HEAD'), Gitlab::Git::BLANK_SHA)
+ expect(rev_list_all).to be(false)
repository.clean_stale_repository_files
- expect(rev_list_all).to be true
- expect(File.exist?(worktree_path)).to be_falsey
+ expect(rev_list_all).to be(true)
+ expect(File.exist?(gitlab_worktree_path)).to be_falsey
end
def rev_list_all