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
eb9ed01d
Commit
eb9ed01d
authored
Feb 24, 2021
by
Erick Bajao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return suite_errors in test suite comparer
parent
66b9dc01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
1 deletion
+64
-1
app/serializers/test_suite_comparer_entity.rb
app/serializers/test_suite_comparer_entity.rb
+12
-0
spec/fixtures/api/schemas/entities/test_suite_comparer.json
spec/fixtures/api/schemas/entities/test_suite_comparer.json
+8
-1
spec/serializers/test_suite_comparer_entity_spec.rb
spec/serializers/test_suite_comparer_entity_spec.rb
+44
-0
No files found.
app/serializers/test_suite_comparer_entity.rb
View file @
eb9ed01d
...
...
@@ -34,4 +34,16 @@ class TestSuiteComparerEntity < Grape::Entity
expose
:resolved_errors
,
using:
TestCaseEntity
do
|
suite
|
suite
.
limited_tests
.
resolved_errors
end
expose
:suite_errors
do
|
suite
|
head_suite_error
=
suite
.
head_suite
.
suite_error
base_suite_error
=
suite
.
base_suite
.
suite_error
next
unless
head_suite_error
.
present?
||
base_suite_error
.
present?
{
head:
head_suite_error
,
base:
base_suite_error
}
end
end
spec/fixtures/api/schemas/entities/test_suite_comparer.json
View file @
eb9ed01d
...
...
@@ -26,7 +26,14 @@
"existing_failures"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"test_case.json"
}
},
"new_errors"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"test_case.json"
}
},
"resolved_errors"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"test_case.json"
}
},
"existing_errors"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"test_case.json"
}
}
"existing_errors"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"test_case.json"
}
},
"suite_errors"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"head"
:
{
"type"
:
[
"string"
,
"null"
]
},
"base"
:
{
"type"
:
[
"string"
,
"null"
]
}
}
}
},
"additionalProperties"
:
false
}
spec/serializers/test_suite_comparer_entity_spec.rb
View file @
eb9ed01d
...
...
@@ -35,6 +35,7 @@ RSpec.describe TestSuiteComparerEntity do
end
expect
(
subject
[
:resolved_failures
]).
to
be_empty
expect
(
subject
[
:existing_failures
]).
to
be_empty
expect
(
subject
[
:suite_errors
]).
to
be_nil
end
end
...
...
@@ -56,6 +57,7 @@ RSpec.describe TestSuiteComparerEntity do
end
expect
(
subject
[
:resolved_failures
]).
to
be_empty
expect
(
subject
[
:existing_failures
]).
to
be_empty
expect
(
subject
[
:suite_errors
]).
to
be_nil
end
end
...
...
@@ -77,6 +79,7 @@ RSpec.describe TestSuiteComparerEntity do
expect
(
existing_failure
[
:execution_time
]).
to
eq
(
test_case_failed
.
execution_time
)
expect
(
existing_failure
[
:system_output
]).
to
eq
(
test_case_failed
.
system_output
)
end
expect
(
subject
[
:suite_errors
]).
to
be_nil
end
end
...
...
@@ -98,6 +101,47 @@ RSpec.describe TestSuiteComparerEntity do
expect
(
resolved_failure
[
:system_output
]).
to
eq
(
test_case_success
.
system_output
)
end
expect
(
subject
[
:existing_failures
]).
to
be_empty
expect
(
subject
[
:suite_errors
]).
to
be_nil
end
end
context
'when head suite has suite error'
do
before
do
allow
(
head_suite
).
to
receive
(
:suite_error
).
and_return
(
'some error'
)
end
it
'contains suite error for head suite'
do
expect
(
subject
[
:suite_errors
]).
to
eq
(
head:
'some error'
,
base:
nil
)
end
end
context
'when base suite has suite error'
do
before
do
allow
(
base_suite
).
to
receive
(
:suite_error
).
and_return
(
'some error'
)
end
it
'contains suite error for head suite'
do
expect
(
subject
[
:suite_errors
]).
to
eq
(
head:
nil
,
base:
'some error'
)
end
end
context
'when base and head suite both have suite errors'
do
before
do
allow
(
head_suite
).
to
receive
(
:suite_error
).
and_return
(
'head error'
)
allow
(
base_suite
).
to
receive
(
:suite_error
).
and_return
(
'base error'
)
end
it
'contains suite error for head suite'
do
expect
(
subject
[
:suite_errors
]).
to
eq
(
head:
'head error'
,
base:
'base error'
)
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