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
e20d125f
Commit
e20d125f
authored
Oct 06, 2021
by
Andrejs Cunskis
Committed by
Ramya Authappan
Oct 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: validate project migration for Gitlab migration functionality
parent
58defbce
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
0 deletions
+132
-0
qa/qa/resource/group_base.rb
qa/qa/resource/group_base.rb
+16
-0
qa/qa/resource/project.rb
qa/qa/resource/project.rb
+40
-0
qa/qa/specs/features/api/1_manage/bulk_import_project_spec.rb
...a/specs/features/api/1_manage/bulk_import_project_spec.rb
+76
-0
No files found.
qa/qa/resource/group_base.rb
View file @
e20d125f
...
...
@@ -14,6 +14,22 @@ module QA
:name
,
:full_path
# Get group projects
#
# @return [Array<QA::Resource::Project>]
def
projects
parse_body
(
api_get_from
(
"
#{
api_get_path
}
/projects"
)).
map
do
|
project
|
Project
.
init
do
|
resource
|
resource
.
api_client
=
api_client
resource
.
group
=
self
resource
.
id
=
project
[
:id
]
resource
.
name
=
project
[
:name
]
resource
.
description
=
project
[
:description
]
resource
.
path_with_namespace
=
project
[
:path_with_namespace
]
end
end
end
# Get group labels
#
# @return [Array<QA::Resource::GroupLabel>]
...
...
qa/qa/resource/project.rb
View file @
e20d125f
...
...
@@ -358,6 +358,46 @@ module QA
parse_body
(
response
)
end
# Object comparison
#
# @param [QA::Resource::Project] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
Project
)
&&
comparable_project
==
other
.
comparable_project
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_project
)
end
protected
# Return subset of fields for comparing projects
#
# @return [Hash]
def
comparable_project
reload!
if
api_response
.
nil?
api_resource
.
slice
(
:name
,
:path
,
:description
,
:tag_list
,
:archived
,
:issues_enabled
,
:merge_request_enabled
,
:wiki_enabled
,
:jobs_enabled
,
:snippets_enabled
,
:shared_runners_enabled
,
:request_access_enabled
,
:avatar_url
)
end
private
def
transform_api_resource
(
api_resource
)
...
...
qa/qa/specs/features/api/1_manage/bulk_import_project_spec.rb
0 → 100644
View file @
e20d125f
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Manage'
,
:requires_admin
do
describe
'Bulk project import'
do
let!
(
:staging?
)
{
Runtime
::
Scenario
.
gitlab_address
.
include?
(
'staging.gitlab.com'
)
}
let
(
:import_wait_duration
)
{
{
max_duration:
300
,
sleep_interval:
2
}
}
let
(
:admin_api_client
)
{
Runtime
::
API
::
Client
.
as_admin
}
let
(
:user
)
do
Resource
::
User
.
fabricate_via_api!
do
|
usr
|
usr
.
api_client
=
admin_api_client
usr
.
hard_delete_on_api_removal
=
true
end
end
let
(
:api_client
)
{
Runtime
::
API
::
Client
.
new
(
user:
user
)
}
let
(
:sandbox
)
do
Resource
::
Sandbox
.
fabricate_via_api!
do
|
group
|
group
.
api_client
=
admin_api_client
end
end
let
(
:source_group
)
do
Resource
::
Sandbox
.
fabricate_via_api!
do
|
group
|
group
.
api_client
=
api_client
group
.
path
=
"source-group-for-import-
#{
SecureRandom
.
hex
(
4
)
}
"
end
end
let
(
:source_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
api_client
=
api_client
project
.
group
=
source_group
end
end
let
(
:imported_group
)
do
Resource
::
BulkImportGroup
.
fabricate_via_api!
do
|
group
|
group
.
api_client
=
api_client
group
.
sandbox
=
sandbox
group
.
source_group_path
=
source_group
.
path
end
end
before
do
Runtime
::
Feature
.
enable
(
:bulk_import_projects
)
Runtime
::
Feature
.
enable
(
:top_level_group_creation_enabled
)
if
staging?
sandbox
.
add_member
(
user
,
Resource
::
Members
::
AccessLevel
::
MAINTAINER
)
source_project
# fabricate source group and project
end
after
do
user
.
remove_via_api!
ensure
Runtime
::
Feature
.
disable
(
:bulk_import_projects
)
Runtime
::
Feature
.
disable
(
:top_level_group_creation_enabled
)
if
staging?
end
context
'with project'
do
it
'successfully imports project'
do
expect
{
imported_group
.
import_status
}.
to
eventually_eq
(
'finished'
).
within
(
import_wait_duration
)
imported_projects
=
imported_group
.
reload!
.
projects
aggregate_failures
do
expect
(
imported_projects
.
count
).
to
eq
(
1
)
expect
(
imported_projects
.
first
).
to
eq
(
source_project
)
end
end
end
end
end
end
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