diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-07-06 21:57:58 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-07-06 21:57:58 +0300 |
commit | e0c0ce28ea786a23d15eee95d56560079b0c6dfe (patch) | |
tree | 29788364ad9108712307d3a051ee130a1a8c495a /spec/services | |
parent | f6e822cdbdf2d38f61926d5af6566d7f41e97361 (diff) | |
parent | 805645510a26d11bceb75868996a76eba10ef470 (diff) |
Merge branch '46246-gitlab-project-export-should-use-object-storage' into 'master'
Resolve "GitLab Project export should use object storage"
Closes #46246
See merge request gitlab-org/gitlab-ce!20105
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/import_export_clean_up_service_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/services/import_export_clean_up_service_spec.rb b/spec/services/import_export_clean_up_service_spec.rb index 1875d0448cd..d5fcef1246f 100644 --- a/spec/services/import_export_clean_up_service_spec.rb +++ b/spec/services/import_export_clean_up_service_spec.rb @@ -11,7 +11,6 @@ describe ImportExportCleanUpService do path = '/invalid/path/' stub_repository_downloads_path(path) - expect(File).to receive(:directory?).with(path + tmp_import_export_folder).and_return(false).at_least(:once) expect(service).not_to receive(:clean_up_export_files) service.execute @@ -38,6 +37,24 @@ describe ImportExportCleanUpService do end end + context 'with uploader exports' do + it 'removes old files' do + upload = create(:import_export_upload, + updated_at: 2.days.ago, + export_file: fixture_file_upload('spec/fixtures/project_export.tar.gz')) + + expect { service.execute }.to change { upload.reload.export_file.file.nil? }.to(true) + end + + it 'does not remove new files' do + upload = create(:import_export_upload, + updated_at: 1.hour.ago, + export_file: fixture_file_upload('spec/fixtures/project_export.tar.gz')) + + expect { service.execute }.not_to change { upload.reload.export_file.file.nil? } + end + end + def in_directory_with_files(mtime:) Dir.mktmpdir do |tmpdir| stub_repository_downloads_path(tmpdir) |