diff options
Diffstat (limited to 'spec/lib/gitlab/git')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 38 | ||||
-rw-r--r-- | spec/lib/gitlab/git/wiki_spec.rb | 2 |
2 files changed, 1 insertions, 39 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index f1b6a59abf9..ae6ca728573 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -2252,44 +2252,6 @@ RSpec.describe Gitlab::Git::Repository, :seed_helper do end end - describe '#clean_stale_repository_files' do - 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 #{gitlab_worktree_path} master] - raise 'preparation failed' unless system(*create_worktree, err: '/dev/null') - - 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(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?(gitlab_worktree_path)).to be_falsey - end - - def rev_list_all - system(*%W[git -C #{repository_path} rev-list --all], out: '/dev/null', err: '/dev/null') - end - - it 'increments a counter upon an error' do - expect(repository.gitaly_repository_client).to receive(:cleanup).and_raise(Gitlab::Git::CommandError) - - counter = double(:counter) - - expect(counter).to receive(:increment) - expect(Gitlab::Metrics).to receive(:counter).with(:failed_repository_cleanup_total, - 'Number of failed repository cleanup events').and_return(counter) - - repository.clean_stale_repository_files - end - end - describe '#squash' do let(:branch_name) { 'fix' } let(:start_sha) { '4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6' } diff --git a/spec/lib/gitlab/git/wiki_spec.rb b/spec/lib/gitlab/git/wiki_spec.rb index eb7deb08063..ee0c0e2708e 100644 --- a/spec/lib/gitlab/git/wiki_spec.rb +++ b/spec/lib/gitlab/git/wiki_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Gitlab::Git::Wiki do using RSpec::Parameterized::TableSyntax let(:project) { create(:project) } - let(:user) { project.owner } + let(:user) { project.first_owner } let(:project_wiki) { ProjectWiki.new(project, user) } subject(:wiki) { project_wiki.wiki } |