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
a876a468
Commit
a876a468
authored
Aug 21, 2021
by
Andrejs Cunskis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve failure messages for large github import spec
parent
31462b14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb
...cs/features/api/1_manage/import_large_github_repo_spec.rb
+21
-14
No files found.
qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb
View file @
a876a468
...
...
@@ -221,32 +221,39 @@ module QA
# @return [void]
def
verify_mrs_or_issues
(
type
)
msg
=
->
(
title
)
{
"expected
#{
type
}
with title '
#{
title
}
' to have"
}
# Compare length to have easy to read overview how many objects are missing
expected
=
type
==
'mr'
?
mrs
:
gl_issues
actual
=
type
==
'mr'
?
gh_prs
:
gh_issues
count_msg
=
"Expected to contain same amount of
#{
type
}
s. Gitlab:
#{
expected
.
length
}
, Github:
#{
actual
.
length
}
"
expect
(
expected
.
length
).
to
eq
(
actual
.
length
),
count_msg
# Compare length to have easy to read overview how many objects are missing
expect
(
expected
.
length
).
to
(
eq
(
actual
.
length
),
"Expected to contain same amount of
#{
type
}
s. Expected:
#{
expected
.
length
}
, actual:
#{
actual
.
length
}
"
)
logger
.
debug
(
"= Comparing
#{
type
}
s ="
)
actual
.
each
do
|
title
,
actual_item
|
print
"."
# indicate that it is still going but don't spam the output with newlines
expected_item
=
expected
[
title
]
# Print title in the error message to see which object is missing
expect
(
expected_item
).
to
be_truthy
,
"
#{
msg
.
call
(
title
)
}
been imported"
next
unless
expected_item
expect
(
expected_item
[
:body
]).
to
(
include
(
actual_item
[
:body
]),
"
#{
msg
.
call
(
title
)
}
same description. diff:
\n
#{
differ
.
diff
(
expected_item
[
:body
],
actual_item
[
:body
])
}
"
)
expect
(
expected_item
[
:comments
].
length
).
to
(
eq
(
actual_item
[
:comments
].
length
),
"
#{
msg
.
call
(
title
)
}
same amount of comments"
)
expect
(
expected_item
[
:comments
]).
to
match_array
(
actual_item
[
:comments
])
# Print difference in the description
expected_body
=
expected_item
[
:body
]
actual_body
=
actual_item
[
:body
]
body_msg
=
<<~
MSG
#{
msg
.
call
(
title
)
}
same description. diff:
\n
#{
differ
.
diff
(
expected_item
[
:body
],
actual_item
[
:body
])
}
MSG
expect
(
expected_body
).
to
include
(
actual_body
),
body_msg
# Print amount difference first
expected_comments
=
expected_item
[
:comments
]
actual_comments
=
actual_item
[
:comments
]
comment_count_msg
=
<<~
MSG
#{
msg
.
call
(
title
)
}
same amount of comments. Gitlab:
#{
expected_comments
.
length
}
, Github:
#{
actual_comments
.
length
}
MSG
expect
(
expected_comments
.
length
).
to
eq
(
actual_comments
.
length
),
comment_count_msg
expect
(
expected_comments
).
to
match_array
(
actual_comments
)
end
puts
# print newline after last print to make output pretty
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