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
dd12de65
Commit
dd12de65
authored
Feb 06, 2020
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing specs
- Fix measurement_enabled?
parent
2e5d01ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
4 deletions
+33
-4
lib/tasks/gitlab/import_export/import.rake
lib/tasks/gitlab/import_export/import.rake
+3
-3
spec/tasks/gitlab/import_export/import_rake_spec.rb
spec/tasks/gitlab/import_export/import_rake_spec.rb
+30
-1
No files found.
lib/tasks/gitlab/import_export/import.rake
View file @
dd12de65
...
...
@@ -27,7 +27,7 @@ namespace :gitlab do
project_path:
args
.
project_path
,
username:
args
.
username
,
file_path:
args
.
archive_path
,
measurement_enabled:
args
.
measurement_enabled
measurement_enabled:
args
.
measurement_enabled
==
'true'
).
import
end
end
...
...
@@ -39,7 +39,7 @@ class GitlabProjectImport
@file_path
=
opts
.
fetch
(
:file_path
)
@namespace
=
Namespace
.
find_by_full_path
(
opts
.
fetch
(
:namespace_path
))
@current_user
=
User
.
find_by_username
(
opts
.
fetch
(
:username
))
@measurement_enabled
=
opts
.
fetch
(
:measurement_enabled
||
false
)
@measurement_enabled
=
opts
.
fetch
(
:measurement_enabled
)
end
def
import
...
...
@@ -119,7 +119,7 @@ class GitlabProjectImport
end
def
measurement_enabled?
@measurement_enabled
@measurement_enabled
!=
false
end
# We want to ensure that all Sidekiq jobs are executed
...
...
spec/tasks/gitlab/import_export/import_rake_spec.rb
View file @
dd12de65
...
...
@@ -6,7 +6,8 @@ describe 'gitlab:import_export:import rake task' do
let
(
:username
)
{
'root'
}
let
(
:namespace_path
)
{
username
}
let!
(
:user
)
{
create
(
:user
,
username:
username
)
}
let
(
:task_params
)
{
[
username
,
namespace_path
,
project_name
,
archive_path
]
}
let
(
:measurement_enabled
)
{
false
}
let
(
:task_params
)
{
[
username
,
namespace_path
,
project_name
,
archive_path
,
measurement_enabled
]
}
let
(
:project
)
{
Project
.
find_by_full_path
(
"
#{
namespace_path
}
/
#{
project_name
}
"
)
}
before
do
...
...
@@ -68,6 +69,34 @@ describe 'gitlab:import_export:import rake task' do
subject
end
context
'when measurement is enabled'
do
let
(
:measurement_enabled
)
{
true
}
it
'prints measurement results'
do
expect
{
subject
}.
to
output
(
including
(
'Measuring enabled...'
,
'Number of sql calls:'
,
'Total GC count:'
,
'Total GC count:'
)).
to_stdout
end
end
context
'when measurement is not enabled'
do
let
(
:measurement_enabled
)
{
false
}
it
'output measurement results'
do
expect
{
subject
}.
to_not
output
(
/Measuring enabled.../
).
to_stdout
end
end
context
'when measurement is not provided'
do
let
(
:task_params
)
{
[
username
,
namespace_path
,
project_name
,
archive_path
]
}
it
'does not output measurement results'
do
expect
{
subject
}.
not_to
output
(
/Measuring enabled.../
).
to_stdout
end
it
'does not raise any exception'
do
expect
{
subject
}.
not_to
raise_error
end
end
end
context
'when project import is invalid'
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