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/models | |
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/models')
-rw-r--r-- | spec/models/import_export_upload_spec.rb | 25 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 10 |
2 files changed, 33 insertions, 2 deletions
diff --git a/spec/models/import_export_upload_spec.rb b/spec/models/import_export_upload_spec.rb new file mode 100644 index 00000000000..58af84b8a08 --- /dev/null +++ b/spec/models/import_export_upload_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe ImportExportUpload do + subject { described_class.new(project: create(:project)) } + + shared_examples 'stores the Import/Export file' do |method| + it 'stores the import file' do + subject.public_send("#{method}=", fixture_file_upload('spec/fixtures/project_export.tar.gz')) + + subject.save! + + url = "/uploads/-/system/import_export_upload/#{method}/#{subject.id}/project_export.tar.gz" + + expect(subject.public_send(method).url).to eq(url) + end + end + + context 'import' do + it_behaves_like 'stores the Import/Export file', :import_file + end + + context 'export' do + it_behaves_like 'stores the Import/Export file', :export_file + end +end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index c3aa6cd6fed..b9512b81678 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2782,6 +2782,10 @@ describe Project do let(:legacy_project) { create(:project, :legacy_storage, :with_export) } let(:project) { create(:project, :with_export) } + before do + stub_feature_flags(import_export_object_storage: false) + end + it 'removes the exports directory for the project' do expect(File.exist?(project.export_path)).to be_truthy @@ -2830,12 +2834,14 @@ describe Project do let(:project) { create(:project, :with_export) } it 'removes the exported project file' do + stub_feature_flags(import_export_object_storage: false) + exported_file = project.export_project_path expect(File.exist?(exported_file)).to be_truthy - allow(FileUtils).to receive(:rm_f).and_call_original - expect(FileUtils).to receive(:rm_f).with(exported_file).and_call_original + allow(FileUtils).to receive(:rm_rf).and_call_original + expect(FileUtils).to receive(:rm_rf).with(exported_file).and_call_original project.remove_exported_project_file |