Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
1bae5371
Commit
1bae5371
authored
Sep 28, 2015
by
Nathaniel Manista
Browse files
Options
Downloads
Plain Diff
Merge pull request #3458 from ctiller/flaky-ist-gut
Add retries for flaky tests (enabled by default for now).
parents
0f9a118f
d7e09c31
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/run_tests/jobset.py
+32
-19
32 additions, 19 deletions
tools/run_tests/jobset.py
with
32 additions
and
19 deletions
tools/run_tests/jobset.py
+
32
−
19
View file @
1bae5371
...
@@ -72,6 +72,7 @@ _COLORS = {
...
@@ -72,6 +72,7 @@ _COLORS = {
'
yellow
'
:
[
33
,
0
],
'
yellow
'
:
[
33
,
0
],
'
lightgray
'
:
[
37
,
0
],
'
lightgray
'
:
[
37
,
0
],
'
gray
'
:
[
30
,
1
],
'
gray
'
:
[
30
,
1
],
'
purple
'
:
[
35
,
0
],
}
}
...
@@ -81,6 +82,7 @@ _CLEAR_LINE = '\x1b[2K'
...
@@ -81,6 +82,7 @@ _CLEAR_LINE = '\x1b[2K'
_TAG_COLOR
=
{
_TAG_COLOR
=
{
'
FAILED
'
:
'
red
'
,
'
FAILED
'
:
'
red
'
,
'
FLAKE
'
:
'
purple
'
,
'
WARNING
'
:
'
yellow
'
,
'
WARNING
'
:
'
yellow
'
,
'
TIMEOUT
'
:
'
red
'
,
'
TIMEOUT
'
:
'
red
'
,
'
PASSED
'
:
'
green
'
,
'
PASSED
'
:
'
green
'
,
...
@@ -131,7 +133,7 @@ class JobSpec(object):
...
@@ -131,7 +133,7 @@ class JobSpec(object):
"""
Specifies what to run for a job.
"""
"""
Specifies what to run for a job.
"""
def
__init__
(
self
,
cmdline
,
shortname
=
None
,
environ
=
None
,
hash_targets
=
None
,
def
__init__
(
self
,
cmdline
,
shortname
=
None
,
environ
=
None
,
hash_targets
=
None
,
cwd
=
None
,
shell
=
False
,
timeout_seconds
=
5
*
60
):
cwd
=
None
,
shell
=
False
,
timeout_seconds
=
5
*
60
,
flake_retries
=
5
):
"""
"""
Arguments:
Arguments:
cmdline: a list of arguments to pass as the command line
cmdline: a list of arguments to pass as the command line
...
@@ -150,6 +152,7 @@ class JobSpec(object):
...
@@ -150,6 +152,7 @@ class JobSpec(object):
self
.
cwd
=
cwd
self
.
cwd
=
cwd
self
.
shell
=
shell
self
.
shell
=
shell
self
.
timeout_seconds
=
timeout_seconds
self
.
timeout_seconds
=
timeout_seconds
self
.
flake_retries
=
flake_retries
def
identity
(
self
):
def
identity
(
self
):
return
'
%r %r %r
'
%
(
self
.
cmdline
,
self
.
environ
,
self
.
hash_targets
)
return
'
%r %r %r
'
%
(
self
.
cmdline
,
self
.
environ
,
self
.
hash_targets
)
...
@@ -167,25 +170,28 @@ class Job(object):
...
@@ -167,25 +170,28 @@ class Job(object):
def
__init__
(
self
,
spec
,
bin_hash
,
newline_on_success
,
travis
,
add_env
,
xml_report
):
def
__init__
(
self
,
spec
,
bin_hash
,
newline_on_success
,
travis
,
add_env
,
xml_report
):
self
.
_spec
=
spec
self
.
_spec
=
spec
self
.
_bin_hash
=
bin_hash
self
.
_bin_hash
=
bin_hash
self
.
_newline_on_success
=
newline_on_success
self
.
_travis
=
travis
self
.
_add_env
=
add_env
.
copy
()
self
.
_xml_test
=
ET
.
SubElement
(
xml_report
,
'
testcase
'
,
name
=
self
.
_spec
.
shortname
)
if
xml_report
is
not
None
else
None
self
.
_retries
=
0
message
(
'
START
'
,
spec
.
shortname
,
do_newline
=
self
.
_travis
)
self
.
start
()
def
start
(
self
):
self
.
_tempfile
=
tempfile
.
TemporaryFile
()
self
.
_tempfile
=
tempfile
.
TemporaryFile
()
env
=
os
.
environ
.
copy
()
env
=
dict
(
os
.
environ
)
for
k
,
v
in
spec
.
environ
.
iteritems
():
env
.
update
(
self
.
_spec
.
environ
)
env
[
k
]
=
v
env
.
update
(
self
.
_add_env
)
for
k
,
v
in
add_env
.
iteritems
():
env
[
k
]
=
v
self
.
_start
=
time
.
time
()
self
.
_start
=
time
.
time
()
message
(
'
START
'
,
spec
.
shortname
,
do_newline
=
travis
)
self
.
_process
=
subprocess
.
Popen
(
args
=
self
.
_spec
.
cmdline
,
self
.
_process
=
subprocess
.
Popen
(
args
=
spec
.
cmdline
,
stderr
=
subprocess
.
STDOUT
,
stderr
=
subprocess
.
STDOUT
,
stdout
=
self
.
_tempfile
,
stdout
=
self
.
_tempfile
,
cwd
=
spec
.
cwd
,
cwd
=
self
.
_
spec
.
cwd
,
shell
=
spec
.
shell
,
shell
=
self
.
_
spec
.
shell
,
env
=
env
)
env
=
env
)
self
.
_state
=
_RUNNING
self
.
_state
=
_RUNNING
self
.
_newline_on_success
=
newline_on_success
self
.
_travis
=
travis
self
.
_xml_test
=
ET
.
SubElement
(
xml_report
,
'
testcase
'
,
name
=
self
.
_spec
.
shortname
)
if
xml_report
is
not
None
else
None
def
state
(
self
,
update_cache
):
def
state
(
self
,
update_cache
):
"""
Poll current state of the job. Prints messages at completion.
"""
"""
Poll current state of the job. Prints messages at completion.
"""
...
@@ -202,6 +208,13 @@ class Job(object):
...
@@ -202,6 +208,13 @@ class Job(object):
self
.
_xml_test
.
set
(
'
time
'
,
str
(
elapsed
))
self
.
_xml_test
.
set
(
'
time
'
,
str
(
elapsed
))
ET
.
SubElement
(
self
.
_xml_test
,
'
system-out
'
).
text
=
filtered_stdout
ET
.
SubElement
(
self
.
_xml_test
,
'
system-out
'
).
text
=
filtered_stdout
if
self
.
_process
.
returncode
!=
0
:
if
self
.
_process
.
returncode
!=
0
:
if
self
.
_retries
<
self
.
_spec
.
flake_retries
:
message
(
'
FLAKE
'
,
'
%s [ret=%d, pid=%d]
'
%
(
self
.
_spec
.
shortname
,
self
.
_process
.
returncode
,
self
.
_process
.
pid
),
stdout
,
do_newline
=
True
)
self
.
_retries
+=
1
self
.
start
()
else
:
self
.
_state
=
_FAILURE
self
.
_state
=
_FAILURE
message
(
'
FAILED
'
,
'
%s [ret=%d, pid=%d]
'
%
(
message
(
'
FAILED
'
,
'
%s [ret=%d, pid=%d]
'
%
(
self
.
_spec
.
shortname
,
self
.
_process
.
returncode
,
self
.
_process
.
pid
),
self
.
_spec
.
shortname
,
self
.
_process
.
returncode
,
self
.
_process
.
pid
),
...
@@ -210,7 +223,7 @@ class Job(object):
...
@@ -210,7 +223,7 @@ class Job(object):
ET
.
SubElement
(
self
.
_xml_test
,
'
failure
'
,
message
=
'
Failure
'
).
text
ET
.
SubElement
(
self
.
_xml_test
,
'
failure
'
,
message
=
'
Failure
'
).
text
else
:
else
:
self
.
_state
=
_SUCCESS
self
.
_state
=
_SUCCESS
message
(
'
PASSED
'
,
'
%s [time=%.1fsec]
'
%
(
self
.
_spec
.
shortname
,
elapsed
),
message
(
'
PASSED
'
,
'
%s [time=%.1fsec
; retries=%d
]
'
%
(
self
.
_spec
.
shortname
,
elapsed
,
self
.
_retries
),
do_newline
=
self
.
_newline_on_success
or
self
.
_travis
)
do_newline
=
self
.
_newline_on_success
or
self
.
_travis
)
if
self
.
_bin_hash
:
if
self
.
_bin_hash
:
update_cache
.
finished
(
self
.
_spec
.
identity
(),
self
.
_bin_hash
)
update_cache
.
finished
(
self
.
_spec
.
identity
(),
self
.
_bin_hash
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment