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
5d32a7a1
Commit
5d32a7a1
authored
Apr 03, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
d74fcc9b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
60 additions
and
64 deletions
+60
-64
.rubocop.yml
.rubocop.yml
+0
-2
lib/gitlab/ci/reports/test_case.rb
lib/gitlab/ci/reports/test_case.rb
+11
-12
qa/qa/page/base.rb
qa/qa/page/base.rb
+17
-0
qa/qa/page/main/login.rb
qa/qa/page/main/login.rb
+2
-0
qa/qa/page/main/menu.rb
qa/qa/page/main/menu.rb
+2
-0
qa/qa/page/validatable.rb
qa/qa/page/validatable.rb
+2
-0
qa/qa/runtime/env.rb
qa/qa/runtime/env.rb
+4
-0
qa/spec/spec_helper.rb
qa/spec/spec_helper.rb
+2
-1
spec/factories/ci/test_case.rb
spec/factories/ci/test_case.rb
+4
-3
spec/lib/gitlab/ci/reports/test_case_spec.rb
spec/lib/gitlab/ci/reports/test_case_spec.rb
+16
-46
No files found.
.rubocop.yml
View file @
5d32a7a1
...
@@ -221,14 +221,12 @@ Gitlab/DuplicateSpecLocation:
...
@@ -221,14 +221,12 @@ Gitlab/DuplicateSpecLocation:
-
ee/spec/services/merge_requests/create_service_spec.rb
-
ee/spec/services/merge_requests/create_service_spec.rb
-
ee/spec/services/merge_requests/refresh_service_spec.rb
-
ee/spec/services/merge_requests/refresh_service_spec.rb
-
ee/spec/services/merge_requests/update_service_spec.rb
-
ee/spec/services/merge_requests/update_service_spec.rb
-
ee/spec/services/system_hooks_service_spec.rb
-
ee/spec/helpers/ee/auth_helper_spec.rb
-
ee/spec/helpers/ee/auth_helper_spec.rb
-
ee/spec/models/ee/namespace_spec.rb
-
ee/spec/models/ee/namespace_spec.rb
-
ee/spec/services/ee/issues/create_service_spec.rb
-
ee/spec/services/ee/issues/create_service_spec.rb
-
ee/spec/services/ee/merge_requests/create_service_spec.rb
-
ee/spec/services/ee/merge_requests/create_service_spec.rb
-
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
-
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
-
ee/spec/services/ee/merge_requests/update_service_spec.rb
-
ee/spec/services/ee/merge_requests/update_service_spec.rb
-
ee/spec/services/ee/system_hooks_service_spec.rb
Cop/InjectEnterpriseEditionModule
:
Cop/InjectEnterpriseEditionModule
:
Enabled
:
true
Enabled
:
true
...
...
lib/gitlab/ci/reports/test_case.rb
View file @
5d32a7a1
...
@@ -12,20 +12,19 @@ module Gitlab
...
@@ -12,20 +12,19 @@ module Gitlab
attr_reader
:name
,
:classname
,
:execution_time
,
:status
,
:file
,
:system_output
,
:stack_trace
,
:key
,
:attachment
,
:job
attr_reader
:name
,
:classname
,
:execution_time
,
:status
,
:file
,
:system_output
,
:stack_trace
,
:key
,
:attachment
,
:job
# rubocop: disable Metrics/ParameterLists
def
initialize
(
params
)
def
initialize
(
name
:,
classname
:,
execution_time
:,
status
:,
file:
nil
,
system_output:
nil
,
stack_trace:
nil
,
attachment:
nil
,
job:
nil
)
@name
=
params
.
fetch
(
:name
)
@name
=
name
@classname
=
params
.
fetch
(
:classname
)
@classname
=
classname
@file
=
params
.
fetch
(
:file
,
nil
)
@file
=
file
@execution_time
=
params
.
fetch
(
:execution_time
).
to_f
@execution_time
=
execution_time
.
to_f
@status
=
params
.
fetch
(
:status
)
@status
=
status
@system_output
=
params
.
fetch
(
:system_output
,
nil
)
@system_output
=
system_output
@stack_trace
=
params
.
fetch
(
:stack_trace
,
nil
)
@stack_trace
=
stack_trace
@attachment
=
params
.
fetch
(
:attachment
,
nil
)
@job
=
params
.
fetch
(
:job
,
nil
)
@key
=
sanitize_key_name
(
"
#{
classname
}
_
#{
name
}
"
)
@key
=
sanitize_key_name
(
"
#{
classname
}
_
#{
name
}
"
)
@attachment
=
attachment
@job
=
job
end
end
# rubocop: enable Metrics/ParameterLists
def
has_attachment?
def
has_attachment?
attachment
.
present?
attachment
.
present?
...
...
qa/qa/page/base.rb
View file @
5d32a7a1
...
@@ -16,6 +16,10 @@ module QA
...
@@ -16,6 +16,10 @@ module QA
def_delegators
:evaluator
,
:view
,
:views
def_delegators
:evaluator
,
:view
,
:views
def
initialize
@retry_later_backoff
=
QA
::
Support
::
Repeater
::
DEFAULT_MAX_WAIT_TIME
end
def
assert_no_element
(
name
)
def
assert_no_element
(
name
)
assert_no_selector
(
element_selector_css
(
name
))
assert_no_selector
(
element_selector_css
(
name
))
end
end
...
@@ -259,6 +263,19 @@ module QA
...
@@ -259,6 +263,19 @@ module QA
visit
find_element
(
name
)[
'href'
]
visit
find_element
(
name
)[
'href'
]
end
end
def
wait_if_retry_later
return
if
@retry_later_backoff
>
QA
::
Support
::
Repeater
::
DEFAULT_MAX_WAIT_TIME
*
5
if
has_css?
(
'body'
,
text:
'Retry later'
,
wait:
0
)
QA
::
Runtime
::
Logger
.
warn
(
"`Retry later` error occurred. Sleeping for
#{
@retry_later_backoff
}
seconds..."
)
sleep
@retry_later_backoff
refresh
@retry_later_backoff
+=
QA
::
Support
::
Repeater
::
DEFAULT_MAX_WAIT_TIME
wait_if_retry_later
end
end
def
self
.
path
def
self
.
path
raise
NotImplementedError
raise
NotImplementedError
end
end
...
...
qa/qa/page/main/login.rb
View file @
5d32a7a1
...
@@ -152,6 +152,8 @@ module QA
...
@@ -152,6 +152,8 @@ module QA
private
private
def
sign_in_using_gitlab_credentials
(
user
:,
skip_page_validation:
false
)
def
sign_in_using_gitlab_credentials
(
user
:,
skip_page_validation:
false
)
wait_if_retry_later
switch_to_sign_in_tab
if
has_sign_in_tab?
switch_to_sign_in_tab
if
has_sign_in_tab?
switch_to_standard_tab
if
has_standard_tab?
switch_to_standard_tab
if
has_standard_tab?
...
...
qa/qa/page/main/menu.rb
View file @
5d32a7a1
...
@@ -77,6 +77,8 @@ module QA
...
@@ -77,6 +77,8 @@ module QA
def
sign_out
def
sign_out
retry_until
do
retry_until
do
wait_if_retry_later
break
true
unless
signed_in?
break
true
unless
signed_in?
within_user_menu
do
within_user_menu
do
...
...
qa/qa/page/validatable.rb
View file @
5d32a7a1
...
@@ -8,6 +8,8 @@ module QA
...
@@ -8,6 +8,8 @@ module QA
def
validate_elements_present!
def
validate_elements_present!
base_page
=
self
.
new
base_page
=
self
.
new
base_page
.
wait_if_retry_later
elements
.
each
do
|
element
|
elements
.
each
do
|
element
|
next
unless
element
.
required?
next
unless
element
.
required?
...
...
qa/qa/runtime/env.rb
View file @
5d32a7a1
...
@@ -43,6 +43,10 @@ module QA
...
@@ -43,6 +43,10 @@ module QA
ENV
[
'GITLAB_QA_ADMIN_ACCESS_TOKEN'
]
ENV
[
'GITLAB_QA_ADMIN_ACCESS_TOKEN'
]
end
end
def
ci_project_name
ENV
[
'CI_PROJECT_NAME'
]
end
def
debug?
def
debug?
enabled?
(
ENV
[
'QA_DEBUG'
],
default:
false
)
enabled?
(
ENV
[
'QA_DEBUG'
],
default:
false
)
end
end
...
...
qa/spec/spec_helper.rb
View file @
5d32a7a1
...
@@ -63,8 +63,9 @@ RSpec.configure do |config|
...
@@ -63,8 +63,9 @@ RSpec.configure do |config|
config
.
display_try_failure_messages
=
true
config
.
display_try_failure_messages
=
true
if
ENV
[
'CI'
]
&&
!
QA
::
Runtime
::
Env
.
disable_rspec_retry?
if
ENV
[
'CI'
]
&&
!
QA
::
Runtime
::
Env
.
disable_rspec_retry?
non_quarantine_retries
=
QA
::
Runtime
::
Env
.
ci_project_name
=~
/staging|canary|production/
?
3
:
2
config
.
around
do
|
example
|
config
.
around
do
|
example
|
retry_times
=
example
.
metadata
.
key?
(
:quarantine
)
?
1
:
2
retry_times
=
example
.
metadata
.
key?
(
:quarantine
)
?
1
:
non_quarantine_retries
example
.
run_with_retry
retry:
retry_times
example
.
run_with_retry
retry:
retry_times
end
end
end
end
...
...
spec/factories/ci/test_case.rb
View file @
5d32a7a1
...
@@ -6,17 +6,18 @@ FactoryBot.define do
...
@@ -6,17 +6,18 @@ FactoryBot.define do
classname
{
"trace"
}
classname
{
"trace"
}
file
{
"spec/trace_spec.rb"
}
file
{
"spec/trace_spec.rb"
}
execution_time
{
1.23
}
execution_time
{
1.23
}
status
{
"success"
}
status
{
Gitlab
::
Ci
::
Reports
::
TestCase
::
STATUS_SUCCESS
}
system_output
{
nil
}
system_output
{
nil
}
attachment
{
nil
}
attachment
{
nil
}
association
:job
,
factory: :ci_build
association
:job
,
factory: :ci_build
trait
:failed
do
trait
:failed
do
status
{
"failed"
}
status
{
Gitlab
::
Ci
::
Reports
::
TestCase
::
STATUS_FAILED
}
system_output
{
"Failure/Error: is_expected.to eq(300) expected: 300 got: -100"
}
end
end
trait
:with_attachment
do
trait
:with_attachment
do
status
{
"failed"
}
status
{
Gitlab
::
Ci
::
Reports
::
TestCase
::
STATUS_FAILED
}
attachment
{
"some/path.png"
}
attachment
{
"some/path.png"
}
end
end
...
...
spec/lib/gitlab/ci/reports/test_case_spec.rb
View file @
5d32a7a1
...
@@ -4,21 +4,12 @@ require 'spec_helper'
...
@@ -4,21 +4,12 @@ require 'spec_helper'
describe
Gitlab
::
Ci
::
Reports
::
TestCase
do
describe
Gitlab
::
Ci
::
Reports
::
TestCase
do
describe
'#initialize'
do
describe
'#initialize'
do
let
(
:test_case
)
{
described_class
.
new
(
**
params
)}
let
(
:test_case
)
{
described_class
.
new
(
params
)}
context
'when both classname and name are given'
do
context
'when both classname and name are given'
do
context
'when test case is passed'
do
context
'when test case is passed'
do
let
(
:params
)
do
let
(
:job
)
{
build
(
:ci_build
)
}
{
let
(
:params
)
{
attributes_for
(
:test_case
).
merge!
(
job:
job
)
}
name:
'test-1'
,
classname:
'trace'
,
file:
'spec/trace_spec.rb'
,
execution_time:
1.23
,
status:
described_class
::
STATUS_SUCCESS
,
system_output:
nil
,
job:
build
(
:ci_build
)
}
end
it
'initializes an instance'
do
it
'initializes an instance'
do
expect
{
test_case
}.
not_to
raise_error
expect
{
test_case
}.
not_to
raise_error
...
@@ -34,16 +25,8 @@ describe Gitlab::Ci::Reports::TestCase do
...
@@ -34,16 +25,8 @@ describe Gitlab::Ci::Reports::TestCase do
end
end
context
'when test case is failed'
do
context
'when test case is failed'
do
let
(
:params
)
do
let
(
:job
)
{
build
(
:ci_build
)
}
{
let
(
:params
)
{
attributes_for
(
:test_case
,
:failed
).
merge!
(
job:
job
)
}
name:
'test-1'
,
classname:
'trace'
,
file:
'spec/trace_spec.rb'
,
execution_time:
1.23
,
status:
described_class
::
STATUS_FAILED
,
system_output:
"Failure/Error: is_expected.to eq(300) expected: 300 got: -100"
}
end
it
'initializes an instance'
do
it
'initializes an instance'
do
expect
{
test_case
}.
not_to
raise_error
expect
{
test_case
}.
not_to
raise_error
...
@@ -59,36 +42,23 @@ describe Gitlab::Ci::Reports::TestCase do
...
@@ -59,36 +42,23 @@ describe Gitlab::Ci::Reports::TestCase do
end
end
end
end
context
'when classname is missing'
do
shared_examples
'param is missing'
do
|
param
|
let
(
:params
)
do
let
(
:job
)
{
build
(
:ci_build
)
}
{
let
(
:params
)
{
attributes_for
(
:test_case
).
merge!
(
job:
job
)
}
name:
'test-1'
,
file:
'spec/trace_spec.rb'
,
execution_time:
1.23
,
status:
described_class
::
STATUS_SUCCESS
,
system_output:
nil
}
end
it
'raises an error'
do
it
'raises an error'
do
expect
{
test_case
}.
to
raise_error
(
ArgumentError
)
params
.
delete
(
param
)
expect
{
test_case
}.
to
raise_error
(
KeyError
)
end
end
end
end
context
'when name is missing'
do
context
'when classname is missing'
do
let
(
:params
)
do
it_behaves_like
'param is missing'
,
:classname
{
end
classname:
'trace'
,
file:
'spec/trace_spec.rb'
,
execution_time:
1.23
,
status:
described_class
::
STATUS_SUCCESS
,
system_output:
nil
}
end
it
'raises an error'
do
context
'when name is missing'
do
expect
{
test_case
}.
to
raise_error
(
ArgumentError
)
it_behaves_like
'param is missing'
,
:name
end
end
end
context
'when attachment is present'
do
context
'when attachment is present'
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