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
7affc231
Commit
7affc231
authored
Jan 26, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add spec
parent
865bb64a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
app/models/project.rb
app/models/project.rb
+1
-0
app/workers/repository_import_worker.rb
app/workers/repository_import_worker.rb
+0
-1
spec/workers/repository_import_worker_spec.rb
spec/workers/repository_import_worker_spec.rb
+13
-0
No files found.
app/models/project.rb
View file @
7affc231
...
@@ -569,6 +569,7 @@ class Project < ActiveRecord::Base
...
@@ -569,6 +569,7 @@ class Project < ActiveRecord::Base
forked_from_project
.
repository_storage_path
,
forked_from_project
.
repository_storage_path
,
forked_from_project
.
disk_path
)
forked_from_project
.
disk_path
)
elsif
gitlab_project_import?
elsif
gitlab_project_import?
# Do not retry on Import/Export until https://gitlab.com/gitlab-org/gitlab-ce/issues/26189 is solved.
RepositoryImportWorker
.
set
(
retry:
false
).
perform_async
(
self
.
id
)
RepositoryImportWorker
.
set
(
retry:
false
).
perform_async
(
self
.
id
)
else
else
RepositoryImportWorker
.
perform_async
(
self
.
id
)
RepositoryImportWorker
.
perform_async
(
self
.
id
)
...
...
app/workers/repository_import_worker.rb
View file @
7affc231
...
@@ -21,7 +21,6 @@ class RepositoryImportWorker
...
@@ -21,7 +21,6 @@ class RepositoryImportWorker
return
if
service
.
async?
return
if
service
.
async?
if
result
[
:status
]
==
:error
if
result
[
:status
]
==
:error
fail_import
(
project
,
result
[
:message
])
if
project
.
gitlab_project_import?
fail_import
(
project
,
result
[
:message
])
if
project
.
gitlab_project_import?
raise
result
[
:message
]
raise
result
[
:message
]
...
...
spec/workers/repository_import_worker_spec.rb
View file @
7affc231
...
@@ -52,6 +52,19 @@ describe RepositoryImportWorker do
...
@@ -52,6 +52,19 @@ describe RepositoryImportWorker do
end
.
to
raise_error
(
StandardError
,
error
)
end
.
to
raise_error
(
StandardError
,
error
)
expect
(
project
.
reload
.
import_jid
).
not_to
be_nil
expect
(
project
.
reload
.
import_jid
).
not_to
be_nil
end
end
it
'updates the error on Import/Export'
do
error
=
%q{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
project
.
update_attributes
(
import_jid:
'123'
,
import_type:
'gitlab_project'
)
expect_any_instance_of
(
Projects
::
ImportService
).
to
receive
(
:execute
).
and_return
({
status: :error
,
message:
error
})
expect
do
subject
.
perform
(
project
.
id
)
end
.
to
raise_error
(
StandardError
,
error
)
expect
(
project
.
reload
.
import_error
).
not_to
be_nil
end
end
end
context
'when using an asynchronous importer'
do
context
'when using an asynchronous importer'
do
...
...
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