Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
9d1c5ef2
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9d1c5ef2
编写于
3月 29, 2015
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #521 from ldoktor/remote2
avocado.remote: Add support for host-timeout [v2]
上级
5f086a3f
689059a6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
11 deletion
+26
-11
avocado/plugins/remote.py
avocado/plugins/remote.py
+4
-0
avocado/plugins/vm.py
avocado/plugins/vm.py
+4
-0
avocado/remote/result.py
avocado/remote/result.py
+2
-0
avocado/remote/runner.py
avocado/remote/runner.py
+13
-8
selftests/all/unit/avocado/remote_unittest.py
selftests/all/unit/avocado/remote_unittest.py
+3
-3
未找到文件。
avocado/plugins/remote.py
浏览文件 @
9d1c5ef2
...
...
@@ -61,6 +61,10 @@ class RunRemote(plugin.Plugin):
action
=
'store_true'
,
help
=
"Don't copy tests and use the "
"exact uri on guest machine."
)
self
.
remote_parser
.
add_argument
(
'--remote-timeout'
,
type
=
float
,
help
=
"Host timeout before the "
"connection is cut off and test "
"set as failed."
)
self
.
configured
=
True
@
staticmethod
...
...
avocado/plugins/vm.py
浏览文件 @
9d1c5ef2
...
...
@@ -67,6 +67,10 @@ class RunVM(plugin.Plugin):
action
=
'store_true'
,
help
=
"Don't copy tests and use the "
"exact uri on VM machine."
)
self
.
vm_parser
.
add_argument
(
'--vm-timeout'
,
type
=
float
,
help
=
"Host timeout before the "
"connection is cut off and test "
"set as failed."
)
self
.
configured
=
True
@
staticmethod
...
...
avocado/remote/result.py
浏览文件 @
9d1c5ef2
...
...
@@ -43,6 +43,7 @@ class RemoteTestResult(HumanTestResult):
self
.
remote
=
None
# Remote runner initialized during setup
self
.
output
=
'-'
self
.
command_line_arg_name
=
'--remote-hostname'
self
.
timeout
=
getattr
(
args
,
'remote_timeout'
,
None
)
def
_copy_tests
(
self
):
"""
...
...
@@ -98,6 +99,7 @@ class VMTestResult(RemoteTestResult):
"""
def
__init__
(
self
,
stream
,
args
):
args
.
remote_timeout
=
getattr
(
args
,
'vm_timeout'
,
None
)
super
(
VMTestResult
,
self
).
__init__
(
stream
,
args
)
self
.
vm
=
None
self
.
command_line_arg_name
=
'--vm-domain'
...
...
avocado/remote/runner.py
浏览文件 @
9d1c5ef2
...
...
@@ -11,18 +11,18 @@
#
# Copyright: Red Hat Inc. 2014-2015
# Author: Ruda Moura <rmoura@redhat.com>
"""Remote test runner."""
import
json
import
os
import
re
from
avocado.core
import
status
from
avocado.core
import
exceptions
from
avocado.utils
import
archive
from
avocado.runner
import
TestRunner
from
avocado.core
import
status
from
avocado.remote.test
import
RemoteTest
from
avocado.runner
import
TestRunner
from
avocado.utils
import
archive
from
fabric.exceptions
import
CommandTimeout
class
RemoteTestRunner
(
TestRunner
):
...
...
@@ -46,7 +46,7 @@ class RemoteTestRunner(TestRunner):
"""
result
=
self
.
result
.
remote
.
run
(
'avocado -v'
,
ignore_status
=
True
,
timeout
=
None
)
timeout
=
60
)
if
result
.
exit_status
==
127
:
return
(
False
,
None
)
...
...
@@ -74,7 +74,7 @@ class RemoteTestRunner(TestRunner):
urls_str
))
check_urls_result
=
self
.
result
.
remote
.
run
(
avocado_check_urls_cmd
,
ignore_status
=
True
,
timeout
=
None
)
timeout
=
60
)
if
check_urls_result
.
exit_status
!=
0
:
raise
exceptions
.
JobError
(
check_urls_result
.
stdout
)
...
...
@@ -82,8 +82,13 @@ class RemoteTestRunner(TestRunner):
'--archive %s'
%
(
self
.
remote_test_dir
,
self
.
result
.
stream
.
job_unique_id
,
urls_str
))
result
=
self
.
result
.
remote
.
run
(
avocado_cmd
,
ignore_status
=
True
,
timeout
=
None
)
try
:
result
=
self
.
result
.
remote
.
run
(
avocado_cmd
,
ignore_status
=
True
,
timeout
=
self
.
result
.
timeout
)
except
CommandTimeout
:
raise
exceptions
.
JobError
(
"Remote execution took longer than "
"specified timeout (%s). Interrupting."
%
(
self
.
result
.
timeout
))
json_result
=
None
for
json_output
in
result
.
stdout
.
splitlines
():
# We expect dictionary:
...
...
selftests/all/unit/avocado/remote_unittest.py
浏览文件 @
9d1c5ef2
...
...
@@ -38,13 +38,13 @@ class RemoteTestRunnerTest(unittest.TestCase):
args
=
'avocado -v'
version_result
=
flexmock
(
stdout
=
'Avocado 1.2.3'
,
exit_status
=
0
)
(
Remote
.
should_receive
(
'run'
)
.
with_args
(
args
,
ignore_status
=
True
,
timeout
=
None
)
.
with_args
(
args
,
ignore_status
=
True
,
timeout
=
60
)
.
once
().
and_return
(
version_result
))
args
=
'cd ~/avocado/tests; avocado list sleeptest --paginator=off'
urls_result
=
flexmock
(
exit_status
=
0
)
(
Remote
.
should_receive
(
'run'
)
.
with_args
(
args
,
timeout
=
None
,
ignore_status
=
True
)
.
with_args
(
args
,
timeout
=
60
,
ignore_status
=
True
)
.
once
().
and_return
(
urls_result
))
args
=
(
"cd ~/avocado/tests; avocado run --force-job-id sleeptest.1 "
...
...
@@ -53,7 +53,7 @@ class RemoteTestRunnerTest(unittest.TestCase):
.
with_args
(
args
,
timeout
=
None
,
ignore_status
=
True
)
.
once
().
and_return
(
test_results
))
Results
=
flexmock
(
remote
=
Remote
,
urls
=
[
'sleeptest'
],
stream
=
stream
)
stream
=
stream
,
timeout
=
None
)
Results
.
should_receive
(
'setup'
).
once
().
ordered
()
Results
.
should_receive
(
'start_tests'
).
once
().
ordered
()
args
=
{
'status'
:
u
'PASS'
,
'whiteboard'
:
''
,
'time_start'
:
0
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录