diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-07 12:06:18 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-07 12:06:18 +0000 |
commit | 185f428fa5e6123ffa0f29e307523da138e7b028 (patch) | |
tree | 1d5bb1d4700c0953aed2ad0e5d3515cc7935e550 /spec/tasks | |
parent | ab2382923e7a864a3fa27fdf8eeb9b21893b9147 (diff) | |
download | gitlab-ce-185f428fa5e6123ffa0f29e307523da138e7b028.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks')
-rw-r--r-- | spec/tasks/gitlab/cleanup_rake_spec.rb | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/spec/tasks/gitlab/cleanup_rake_spec.rb b/spec/tasks/gitlab/cleanup_rake_spec.rb index 4aee6d005a8..6c09bb5d9f9 100644 --- a/spec/tasks/gitlab/cleanup_rake_spec.rb +++ b/spec/tasks/gitlab/cleanup_rake_spec.rb @@ -5,74 +5,6 @@ describe 'gitlab:cleanup rake tasks' do Rake.application.rake_require 'tasks/gitlab/cleanup' end - describe 'cleanup namespaces and repos' do - let(:gitlab_shell) { Gitlab::Shell.new } - let(:storage) { storages.keys.first } - let(:storages) do - { - 'default' => Gitlab::GitalyClient::StorageSettings.new(@default_storage_hash.merge('path' => 'tmp/tests/default_storage')) - } - end - - before(:all) do - @default_storage_hash = Gitlab.config.repositories.storages.default.to_h - end - - before do - allow(Gitlab.config.repositories).to receive(:storages).and_return(storages) - end - - after do - Gitlab::GitalyClient::StorageService.new(storage).delete_all_repositories - end - - describe 'cleanup:repos' do - before do - gitlab_shell.add_namespace(storage, 'broken/project.git') - gitlab_shell.add_namespace(storage, '@hashed/12/34/5678.git') - end - - it 'moves it to an orphaned path' do - now = Time.now - - Timecop.freeze(now) do - run_rake_task('gitlab:cleanup:repos') - repo_list = Gitlab::GitalyClient::StorageService.new(storage).list_directories(depth: 0) - - expect(repo_list.last).to include("broken+orphaned+#{now.to_i}") - end - end - - it 'ignores @hashed repos' do - run_rake_task('gitlab:cleanup:repos') - - expect(gitlab_shell.exists?(storage, '@hashed/12/34/5678.git')).to be(true) - end - end - - describe 'cleanup:dirs' do - it 'removes missing namespaces' do - gitlab_shell.add_namespace(storage, "namespace_1/project.git") - gitlab_shell.add_namespace(storage, "namespace_2/project.git") - allow(Namespace).to receive(:pluck).and_return(['namespace_1']) - - stub_env('REMOVE', 'true') - run_rake_task('gitlab:cleanup:dirs') - - expect(gitlab_shell.exists?(storage, 'namespace_1')).to be(true) - expect(gitlab_shell.exists?(storage, 'namespace_2')).to be(false) - end - - it 'ignores @hashed directory' do - gitlab_shell.add_namespace(storage, '@hashed/12/34/5678.git') - - run_rake_task('gitlab:cleanup:dirs') - - expect(gitlab_shell.exists?(storage, '@hashed/12/34/5678.git')).to be(true) - end - end - end - # A single integration test that is redundant with one part of the # Gitlab::Cleanup::ProjectUploads spec. # |