Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6dfebdcc
Commit
6dfebdcc
authored
Dec 21, 2020
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that tmp pages archive is removed
parent
27103da3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
app/services/pages/migrate_legacy_storage_to_deployment_service.rb
...ces/pages/migrate_legacy_storage_to_deployment_service.rb
+2
-0
spec/services/pages/migrate_legacy_storage_to_deployment_service_spec.rb
...ages/migrate_legacy_storage_to_deployment_service_spec.rb
+23
-0
No files found.
app/services/pages/migrate_legacy_storage_to_deployment_service.rb
View file @
6dfebdcc
...
...
@@ -44,6 +44,8 @@ module Pages
Feature
.
enabled?
(
:pages_migration_mark_as_not_deployed
,
project
)
project
.
mark_pages_as_not_deployed
end
ensure
FileUtils
.
rm_f
(
archive_path
)
if
archive_path
end
end
end
spec/services/pages/migrate_legacy_storage_to_deployment_service_spec.rb
View file @
6dfebdcc
...
...
@@ -34,6 +34,23 @@ RSpec.describe Pages::MigrateLegacyStorageToDeploymentService do
end
.
not_to
change
{
project
.
pages_metadatum
.
reload
.
deployed
}.
from
(
true
)
end
it
'removes pages archive when can not save deployment'
do
archive
=
fixture_file_upload
(
"spec/fixtures/pages.zip"
)
expect_next_instance_of
(
::
Pages
::
ZipDirectoryService
)
do
|
zip_service
|
expect
(
zip_service
).
to
receive
(
:execute
).
and_return
([
archive
.
path
,
3
])
end
expect_next_instance_of
(
PagesDeployment
)
do
|
deployment
|
expect
(
deployment
).
to
receive
(
:save!
).
and_raise
(
"Something"
)
end
expect
do
service
.
execute
end
.
to
raise_error
(
"Something"
)
expect
(
File
.
exist?
(
archive
.
path
)).
to
eq
(
false
)
end
context
'when pages site is deployed to legacy storage'
do
before
do
FileUtils
.
mkdir_p
File
.
join
(
project
.
pages_path
,
"public"
)
...
...
@@ -58,6 +75,12 @@ RSpec.describe Pages::MigrateLegacyStorageToDeploymentService do
expect
(
deployment
.
file_sha256
).
to
eq
(
Digest
::
SHA256
.
file
(
deployment
.
file
.
path
).
hexdigest
)
end
it
'removes tmp pages archive'
do
described_class
.
new
(
project
).
execute
expect
(
File
.
exist?
(
File
.
join
(
project
.
pages_path
,
'@migrated.zip'
))).
to
eq
(
false
)
end
it
'does not change pages deployment if it is set'
do
old_deployment
=
create
(
:pages_deployment
,
project:
project
)
project
.
update_pages_deployment!
(
old_deployment
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment