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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
a26ee804
Commit
a26ee804
authored
Mar 30, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
missing the public folder is InvaildStateError
parent
b4d9d4db
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
app/services/projects/update_pages_service.rb
app/services/projects/update_pages_service.rb
+2
-1
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+8
-5
No files found.
app/services/projects/update_pages_service.rb
View file @
a26ee804
...
@@ -31,7 +31,7 @@ module Projects
...
@@ -31,7 +31,7 @@ module Projects
# Check if we did extract public directory
# Check if we did extract public directory
archive_public_path
=
File
.
join
(
archive_path
,
'public'
)
archive_public_path
=
File
.
join
(
archive_path
,
'public'
)
raise
FailedToExtract
Error
,
'pages miss the public folder'
unless
Dir
.
exist?
(
archive_public_path
)
raise
InvaildState
Error
,
'pages miss the public folder'
unless
Dir
.
exist?
(
archive_public_path
)
raise
InvaildStateError
,
'pages are outdated'
unless
latest?
raise
InvaildStateError
,
'pages are outdated'
unless
latest?
deploy_page!
(
archive_public_path
)
deploy_page!
(
archive_public_path
)
...
@@ -41,6 +41,7 @@ module Projects
...
@@ -41,6 +41,7 @@ module Projects
error
(
e
.
message
)
error
(
e
.
message
)
rescue
=>
e
rescue
=>
e
error
(
e
.
message
,
false
)
error
(
e
.
message
,
false
)
raise
e
end
end
private
private
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
a26ee804
...
@@ -87,7 +87,8 @@ describe Projects::UpdatePagesService do
...
@@ -87,7 +87,8 @@ describe Projects::UpdatePagesService do
it
'fails for empty file fails'
do
it
'fails for empty file fails'
do
build
.
update_attributes
(
legacy_artifacts_file:
empty_file
)
build
.
update_attributes
(
legacy_artifacts_file:
empty_file
)
expect
(
execute
).
not_to
eq
(
:success
)
expect
{
execute
}
.
to
raise_error
(
Projects
::
UpdatePagesService
::
FailedToExtractError
)
end
end
end
end
end
end
...
@@ -159,7 +160,8 @@ describe Projects::UpdatePagesService do
...
@@ -159,7 +160,8 @@ describe Projects::UpdatePagesService do
it
'fails for empty file fails'
do
it
'fails for empty file fails'
do
build
.
job_artifacts_archive
.
update_attributes
(
file:
empty_file
)
build
.
job_artifacts_archive
.
update_attributes
(
file:
empty_file
)
expect
(
execute
).
not_to
eq
(
:success
)
expect
{
execute
}
.
to
raise_error
(
Projects
::
UpdatePagesService
::
FailedToExtractError
)
end
end
context
'when timeout happens by DNS error'
do
context
'when timeout happens by DNS error'
do
...
@@ -169,7 +171,7 @@ describe Projects::UpdatePagesService do
...
@@ -169,7 +171,7 @@ describe Projects::UpdatePagesService do
end
end
it
'raises an error'
do
it
'raises an error'
do
ex
ecute
ex
pect
{
execute
}.
to
raise_error
(
SocketError
)
build
.
reload
build
.
reload
expect
(
deploy_status
).
to
be_failed
expect
(
deploy_status
).
to
be_failed
...
@@ -185,7 +187,8 @@ describe Projects::UpdatePagesService do
...
@@ -185,7 +187,8 @@ describe Projects::UpdatePagesService do
end
end
it
'raises an error'
do
it
'raises an error'
do
execute
expect
{
execute
}
.
to
raise_error
(
Projects
::
UpdatePagesService
::
FailedToExtractError
)
build
.
reload
build
.
reload
expect
(
deploy_status
).
to
be_failed
expect
(
deploy_status
).
to
be_failed
...
@@ -198,7 +201,7 @@ describe Projects::UpdatePagesService do
...
@@ -198,7 +201,7 @@ describe Projects::UpdatePagesService do
allow
(
build
).
to
receive
(
:artifacts_metadata?
).
and_return
(
false
)
allow
(
build
).
to
receive
(
:artifacts_metadata?
).
and_return
(
false
)
end
end
it
'
raises an error
'
do
it
'
does not raise an error and remove artifacts as failed job
'
do
execute
execute
build
.
reload
build
.
reload
...
...
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