Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
d1201443
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,发现更多精彩内容 >>
提交
d1201443
编写于
9月 29, 2015
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #804 from clebergnu/vm_connect_timeout
Remote/VM timeouts: introduce timeout command line options
上级
e7847aa7
997c6094
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
8 deletion
+25
-8
avocado/core/plugins/remote.py
avocado/core/plugins/remote.py
+6
-0
avocado/core/plugins/vm.py
avocado/core/plugins/vm.py
+6
-0
avocado/core/remote/result.py
avocado/core/remote/result.py
+6
-3
avocado/core/remoter.py
avocado/core/remoter.py
+3
-3
selftests/unit/test_remote.py
selftests/unit/test_remote.py
+3
-2
selftests/unit/test_vm.py
selftests/unit/test_vm.py
+1
-0
未找到文件。
avocado/core/plugins/remote.py
浏览文件 @
d1201443
...
...
@@ -62,6 +62,12 @@ 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'
,
metavar
=
'SECONDS'
,
help
=
(
"Amount of time (in seconds) to "
"wait for a successful connection"
" to the remote machine. Defaults"
" to %(default)s seconds."
),
default
=
60
,
type
=
int
)
self
.
configured
=
True
@
staticmethod
...
...
avocado/core/plugins/vm.py
浏览文件 @
d1201443
...
...
@@ -64,6 +64,12 @@ class RunVM(plugin.Plugin):
self
.
vm_parser
.
add_argument
(
'--vm-no-copy'
,
action
=
'store_true'
,
help
=
"Don't copy tests and use the "
"exact uri on VM machine."
)
self
.
vm_parser
.
add_argument
(
'--vm-timeout'
,
metavar
=
'SECONDS'
,
help
=
(
"Amount of time (in seconds) to "
"wait for a successful connection"
" to the virtual machine. Defaults"
" to %(default)s seconds."
),
default
=
120
,
type
=
int
)
self
.
configured
=
True
@
staticmethod
...
...
avocado/core/remote/result.py
浏览文件 @
d1201443
...
...
@@ -79,14 +79,16 @@ class RemoteTestResult(HumanTestResult):
def
setup
(
self
):
""" Setup remote environment and copy test directories """
self
.
stream
.
notify
(
event
=
'message'
,
msg
=
(
"LOGIN : %s@%s:%d"
msg
=
(
"LOGIN : %s@%s:%d
(TIMEOUT: %s seconds)
"
%
(
self
.
args
.
remote_username
,
self
.
args
.
remote_hostname
,
self
.
args
.
remote_port
)))
self
.
args
.
remote_port
,
self
.
args
.
remote_timeout
)))
self
.
remote
=
remoter
.
Remote
(
self
.
args
.
remote_hostname
,
self
.
args
.
remote_username
,
self
.
args
.
remote_password
,
self
.
args
.
remote_port
)
self
.
args
.
remote_port
,
self
.
args
.
remote_timeout
)
def
tear_down
(
self
):
""" Cleanup after test execution """
...
...
@@ -137,6 +139,7 @@ class VMTestResult(RemoteTestResult):
self
.
args
.
remote_username
=
self
.
args
.
vm_username
self
.
args
.
remote_password
=
self
.
args
.
vm_password
self
.
args
.
remote_no_copy
=
self
.
args
.
vm_no_copy
self
.
args
.
remote_timeout
=
self
.
args
.
vm_timeout
super
(
VMTestResult
,
self
).
setup
()
except
Exception
:
self
.
tear_down
()
...
...
avocado/core/remoter.py
浏览文件 @
d1201443
...
...
@@ -43,7 +43,7 @@ class Remote(object):
"""
def
__init__
(
self
,
hostname
,
username
=
None
,
password
=
None
,
port
=
22
,
timeout
=
60
,
attempts
=
3
,
quiet
=
False
):
port
=
22
,
timeout
=
60
,
attempts
=
10
,
quiet
=
False
):
"""
Creates an instance of :class:`Remote`.
...
...
@@ -51,7 +51,7 @@ class Remote(object):
:param username: the username. Default: autodetect.
:param password: the password. Default: try to use public key.
:param timeout: remote command timeout, in seconds. Default: 60.
:param attempts: number of attempts to connect. Default:
3
.
:param attempts: number of attempts to connect. Default:
10
.
:param quiet: performs quiet operations. Default: True.
"""
self
.
hostname
=
hostname
...
...
@@ -66,7 +66,7 @@ class Remote(object):
user
=
username
,
password
=
password
,
port
=
port
,
connection_timeout
=
timeout
,
timeout
=
timeout
/
attempts
,
connection_attempts
=
attempts
,
linewise
=
True
)
...
...
selftests/unit/test_remote.py
浏览文件 @
d1201443
...
...
@@ -136,7 +136,7 @@ class RemoteTestResultTest(unittest.TestCase):
Stream
.
should_receive
(
'notify'
).
once
().
ordered
()
remote_remote
=
flexmock
(
remoter
)
(
remote_remote
.
should_receive
(
'Remote'
)
.
with_args
(
'hostname'
,
'username'
,
'password'
,
22
)
.
with_args
(
'hostname'
,
'username'
,
'password'
,
22
,
60
)
.
once
().
ordered
()
.
and_return
(
Remote
))
Args
=
flexmock
(
test_result_total
=
1
,
...
...
@@ -146,7 +146,8 @@ class RemoteTestResultTest(unittest.TestCase):
remote_hostname
=
'hostname'
,
remote_port
=
22
,
remote_password
=
'password'
,
remote_no_copy
=
False
)
remote_no_copy
=
False
,
remote_timeout
=
60
)
self
.
remote
=
remote
.
RemoteTestResult
(
Stream
,
Args
)
def
tearDown
(
self
):
...
...
selftests/unit/test_vm.py
浏览文件 @
d1201443
...
...
@@ -48,6 +48,7 @@ class VMTestResultTest(unittest.TestCase):
vm_password
=
'password'
,
vm_cleanup
=
True
,
vm_no_copy
=
False
,
vm_timeout
=
120
,
vm_hypervisor_uri
=
'my_hypervisor_uri'
)
self
.
remote
=
VMTestResult
(
Stream
,
Args
)
# vm.RemoteTestResult.tear_down()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录