Commit c9880e78 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'georgekoltsov/add-regenerate-new-export-to-project-export' into 'master'

Remove old export file when requesting new project export using API

See merge request gitlab-org/gitlab!37427
parents 6e1785b0 6b8e1a07
---
title: Remove old export file when requesting new project export using API
merge_request: 37427
author:
type: fixed
......@@ -47,6 +47,8 @@ module API
post ':id/export' do
check_rate_limit! :project_export, [current_user]
user_project.remove_exports
project_export_params = declared_params(include_missing: false)
after_export_params = project_export_params.delete(:upload) || {}
......
......@@ -338,6 +338,16 @@ RSpec.describe API::ProjectExport, :clean_gitlab_redis_cache do
end
context 'with download strategy' do
before do
Grape::Endpoint.before_each do |endpoint|
allow(endpoint).to receive(:user_project).and_return(project)
end
end
after do
Grape::Endpoint.before_each nil
end
it 'starts' do
expect_any_instance_of(Gitlab::ImportExport::AfterExportStrategies::WebUploadStrategy).not_to receive(:send_file)
......@@ -345,6 +355,12 @@ RSpec.describe API::ProjectExport, :clean_gitlab_redis_cache do
expect(response).to have_gitlab_http_status(:accepted)
end
it 'removes previously exported archive file' do
expect(project).to receive(:remove_exports).once
post api(path, user)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment