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
b8380869
Commit
b8380869
authored
Dec 14, 2021
by
Andrejs Cunskis
Committed by
Ramya Authappan
Dec 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: Validate merge request import
parent
596fe508
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
25 deletions
+85
-25
qa/qa/resource/merge_request.rb
qa/qa/resource/merge_request.rb
+35
-0
qa/qa/specs/features/ee/api/1_manage/bulk_import_project_spec.rb
...pecs/features/ee/api/1_manage/bulk_import_project_spec.rb
+50
-25
No files found.
qa/qa/resource/merge_request.rb
View file @
b8380869
...
@@ -168,6 +168,41 @@ module QA
...
@@ -168,6 +168,41 @@ module QA
)
)
end
end
# Object comparison
#
# @param [QA::Resource::MergeRequest] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
MergeRequest
)
&&
comparable_mr
==
other
.
comparable_mr
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_mr
)
end
protected
# Return subset of fields for comparing merge requests
#
# @return [Hash]
def
comparable_mr
reload!
if
api_response
.
nil?
api_resource
.
except
(
:id
,
:web_url
,
:project_id
,
:source_project_id
,
:target_project_id
,
# these can differ depending on user fetching mr
:subscribed
,
:first_contribution
).
merge
({
references:
api_resource
[
:references
].
except
(
:full
)
})
end
private
private
def
transform_api_resource
(
api_resource
)
def
transform_api_resource
(
api_resource
)
...
...
qa/qa/specs/features/ee/api/1_manage/bulk_import_project_spec.rb
View file @
b8380869
...
@@ -45,14 +45,20 @@ module QA
...
@@ -45,14 +45,20 @@ module QA
end
end
end
end
let
(
:imported_projects
)
do
let
(
:imported_projects
)
{
imported_group
.
reload!
.
projects
}
imported_group
.
reload!
.
projects
let
(
:imported_project
)
{
imported_projects
.
first
}
end
let
(
:import_failures
)
do
let
(
:import_failures
)
do
imported_group
.
import_details
.
sum
([])
{
|
details
|
details
[
:failures
]
}
imported_group
.
import_details
.
sum
([])
{
|
details
|
details
[
:failures
]
}
end
end
def
expect_import_finished
imported_group
# trigger import
expect
{
imported_group
.
import_status
}.
to
eventually_eq
(
'finished'
).
within
(
import_wait_duration
)
expect
(
imported_projects
.
count
).
to
eq
(
1
),
'Expected to have 1 imported project'
end
before
do
before
do
Runtime
::
Feature
.
enable
(
:bulk_import_projects
)
Runtime
::
Feature
.
enable
(
:bulk_import_projects
)
...
@@ -72,16 +78,12 @@ module QA
...
@@ -72,16 +78,12 @@ module QA
end
end
context
'with project'
do
context
'with project'
do
before
do
imported_group
# trigger import
end
it
(
it
(
'successfully imports project'
,
'successfully imports project'
,
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347610'
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347610'
)
do
)
do
expect
{
imported_group
.
import_status
}.
to
eventually_eq
(
'finished'
).
within
(
import_wait_duration
)
expect
_import_finished
expect
(
imported_projects
.
count
).
to
eq
(
1
),
'Expected to have 1 imported project'
expect
(
imported_projects
.
first
).
to
eq
(
source_project
)
expect
(
imported_projects
.
first
).
to
eq
(
source_project
)
end
end
end
end
...
@@ -110,26 +112,20 @@ module QA
...
@@ -110,26 +112,20 @@ module QA
before
do
before
do
source_issue
# fabricate source group, project, issue
source_issue
# fabricate source group, project, issue
imported_group
# trigger import
end
end
it
(
it
(
'successfully imports issue'
,
'successfully imports issue'
,
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347608'
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347608'
)
do
)
do
expect
{
imported_group
.
import_status
}.
to
eventually_eq
(
'finished'
).
within
(
import_wait_duration
)
expect_import_finished
expect
(
imported_projects
.
count
).
to
eq
(
1
),
'Expected to have 1 imported project'
aggregate_failures
do
expect
(
imported_issues
.
count
).
to
eq
(
1
)
expect
(
imported_issues
.
count
).
to
eq
(
1
)
expect
(
imported_issue
).
to
eq
(
source_issue
)
expect
(
imported_issue
.
reload!
).
to
eq
(
source_issue
)
end
end
end
end
end
context
'with repository'
do
context
'with repository'
do
let
(
:imported_project
)
{
imported_projects
.
first
}
let
(
:source_commits
)
{
source_project
.
commits
.
map
{
|
c
|
c
.
except
(
:web_url
)
}
}
let
(
:source_commits
)
{
source_project
.
commits
.
map
{
|
c
|
c
.
except
(
:web_url
)
}
}
let
(
:source_tags
)
do
let
(
:source_tags
)
do
source_project
.
repository_tags
.
tap
do
|
tags
|
source_project
.
repository_tags
.
tap
do
|
tags
|
...
@@ -165,17 +161,15 @@ module QA
...
@@ -165,17 +161,15 @@ module QA
before
do
before
do
source_project
.
create_repository_branch
(
'test-branch'
)
source_project
.
create_repository_branch
(
'test-branch'
)
source_project
.
create_repository_tag
(
'v0.0.1'
)
source_project
.
create_repository_tag
(
'v0.0.1'
)
imported_group
# trigger import
end
end
it
(
it
(
'successfully imports repository'
,
'successfully imports repository'
,
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347570'
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347570'
)
do
)
do
expect
{
imported_group
.
import_status
}.
to
eventually_eq
(
'finished'
).
within
(
import_wait_duration
)
expect
(
imported_projects
.
count
).
to
eq
(
1
),
'Expected to have 1 imported project'
aggregate_failures
do
aggregate_failures
do
expect_import_finished
expect
(
imported_commits
).
to
match_array
(
source_commits
)
expect
(
imported_commits
).
to
match_array
(
source_commits
)
expect
(
imported_tags
).
to
match_array
(
source_tags
)
expect
(
imported_tags
).
to
match_array
(
source_tags
)
expect
(
imported_branches
).
to
match_array
(
source_branches
)
expect
(
imported_branches
).
to
match_array
(
source_branches
)
...
@@ -186,18 +180,49 @@ module QA
...
@@ -186,18 +180,49 @@ module QA
context
'with wiki'
do
context
'with wiki'
do
before
do
before
do
source_project
.
create_wiki_page
(
title:
'Import test project wiki'
,
content:
'Wiki content'
)
source_project
.
create_wiki_page
(
title:
'Import test project wiki'
,
content:
'Wiki content'
)
imported_group
# trigger import
end
end
it
(
it
(
'successfully imports project wiki'
,
'successfully imports project wiki'
,
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347567'
testcase:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347567'
)
do
)
do
expect
{
imported_group
.
import_status
}.
to
eventually_eq
(
'finished'
).
within
(
import_wait_duration
)
expect
_import_finished
expect
(
imported_projects
.
count
).
to
eq
(
1
),
'Expected to have 1 imported project'
expect
(
imported_projects
.
first
.
wikis
).
to
eq
(
source_project
.
wikis
)
expect
(
imported_projects
.
first
.
wikis
).
to
eq
(
source_project
.
wikis
)
end
end
end
end
context
'with merge request'
do
let
(
:source_mr
)
do
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
mr
|
mr
.
no_preparation
=
true
mr
.
project
=
source_project
mr
.
api_client
=
api_client
end
end
let
(
:imported_mrs
)
do
imported_project
.
merge_requests
end
let
(
:imported_mr
)
do
Resource
::
MergeRequest
.
init
do
|
mr
|
mr
.
project
=
imported_project
mr
.
iid
=
imported_mrs
.
first
[
:iid
]
end
end
before
do
source_mr
# fabricate mr for import
end
it
'successfully imports merge request'
do
expect_import_finished
expect
(
imported_mrs
.
count
).
to
eq
(
1
)
expect
(
imported_mr
).
to
eq
(
source_mr
)
end
end
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