Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
9c732dc5
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,发现更多精彩内容 >>
未验证
提交
9c732dc5
编写于
12月 17, 2017
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'result_upload-plugin-V5'
Signed-off-by:
N
Cleber Rosa
<
crosa@redhat.com
>
上级
cf93b03d
c75398ea
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
229 addition
and
3 deletion
+229
-3
docs/source/optional_plugins/results.rst
docs/source/optional_plugins/results.rst
+44
-0
etc/avocado/conf.d/result_upload.conf
etc/avocado/conf.d/result_upload.conf
+10
-0
optional_plugins/result_upload/MANIFEST.in
optional_plugins/result_upload/MANIFEST.in
+1
-0
optional_plugins/result_upload/VERSION
optional_plugins/result_upload/VERSION
+1
-0
optional_plugins/result_upload/avocado_result_upload/__init__.py
...l_plugins/result_upload/avocado_result_upload/__init__.py
+110
-0
optional_plugins/result_upload/setup.py
optional_plugins/result_upload/setup.py
+34
-0
python-avocado.spec
python-avocado.spec
+29
-3
未找到文件。
docs/source/optional_plugins/results.rst
浏览文件 @
9c732dc5
...
...
@@ -30,6 +30,50 @@ specify a custom location via --html . Last but not least
the job finishes.
Results Upload Plugin
=====================
This optional plugin is intended to upload the Avocado Job results to
a dedicated sever.
To install the Result Upload plugin from pip, use::
pip install avocado-framework-plugin-result-upload
Usage::
avocado run passtest.py --result-upload-url www@avocadologs.example.com:/var/www/html
Avocado logs will be available at following URL:
- ssh ::
www@avocadologs.example.com:/var/www/html/job-2017-04-21T12.54-1cefe11
- html (If web server is enabled) ::
http://avocadologs.example.com/job-2017-04-21T12.54-1cefe11/
Such links may be refered by other plugins, such as the ResultsDB plugin
By default upload will be handled by following command ::
rsync -arz -e 'ssh -o LogLevel=error -o stricthostkeychecking=no -o userknownhostsfile=/dev/null -o batchmode=yes -o passwordauthentication=no'
Optionally, you can customize uploader command, for example following command upload logs to Google storage: ::
avocado run passtest.py --result-upload-url='gs://avocadolog' --result-upload-cmd='gsutil -m cp -r'
You can also set the ResultUpload URL and command using a config file::
[plugins.result_upload]
url = www@avocadologs.example.com:/var/www/htmlavocado/job-results
command='rsync -arzq'
And then run the Avocado command without the explicit cmd options. Notice
that the command line options will have precedence over the
configuration file.
ResultsDB Plugin
================
...
...
etc/avocado/conf.d/result_upload.conf
0 → 100644
浏览文件 @
9c732dc5
[
plugins
.
result_upload
]
#URL where results will be upload to
#url = www@avocadologs.example.com:/var/www/htmlavocado/job-results
#command to be invoked on upload, $command $job_logdir $url
#command='rsync -arz'
#
## Examples: gcloud storage
#url=gs://avocadolog/
#command='gsutil -m cp -r '
optional_plugins/result_upload/MANIFEST.in
0 → 100644
浏览文件 @
9c732dc5
include VERSION
optional_plugins/result_upload/VERSION
0 → 100644
浏览文件 @
9c732dc5
56.0
optional_plugins/result_upload/avocado_result_upload/__init__.py
0 → 100644
浏览文件 @
9c732dc5
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright: Virtuozzo Inc. 2017
# Authors: Dmitry Monakhov <dmonakhov@openvz.org>
"""
Avocado Plugin to propagate Job results to remote host
"""
from
avocado.core.plugin_interfaces
import
CLI
,
Result
from
avocado.core.settings
import
settings
from
avocado.utils
import
process
from
avocado.utils
import
path
as
utils_path
class
ResultUpload
(
Result
):
"""
ResultsUpload output class
"""
name
=
'result_upload'
description
=
'ResultUpload result support'
def
render
(
self
,
result
,
job
):
"""
Upload result, which corresponds to one test from
the Avocado Job
if job.status == "RUNNING":
return # Don't create results on unfinished jobs
"""
self
.
upload_url
=
None
if
getattr
(
job
.
args
,
'result_upload_url'
,
None
)
is
not
None
:
self
.
upload_url
=
job
.
args
.
result_upload_url
self
.
upload_cmd
=
None
if
getattr
(
job
.
args
,
'result_upload_cmd'
,
None
)
is
not
None
:
self
.
upload_cmd
=
job
.
args
.
result_upload_cmd
if
self
.
upload_url
is
None
:
return
if
self
.
upload_cmd
is
None
:
return
ret
=
process
.
run
(
"%s %s %s"
%
(
self
.
upload_cmd
,
job
.
logdir
,
self
.
upload_url
))
if
ret
.
exit_status
:
job
.
log
.
error
(
"ResultUploader failed msg=%s"
%
result
.
stderr
)
class
ResultUploadCLI
(
CLI
):
"""
ResultsUpload output class
"""
name
=
'result_upload'
description
=
"ResultUpload options for 'run' subcommand"
def
configure
(
self
,
parser
):
run_subcommand_parser
=
parser
.
subcommands
.
choices
.
get
(
'run'
,
None
)
if
run_subcommand_parser
is
None
:
return
msg
=
'result-upload options'
parser
=
run_subcommand_parser
.
add_argument_group
(
msg
)
parser
.
add_argument
(
'--result-upload-url'
,
dest
=
'result_upload_url'
,
default
=
None
,
help
=
'Specify the result upload url'
)
try
:
rsync_bin
=
utils_path
.
find_command
(
'rsync'
)
def_ssh
=
(
'ssh -oLogLevel=error -o stricthostkeychecking=no'
' -o userknownhostsfile=/dev/null'
' -o batchmode=yes -o passwordauthentication=no'
)
def_upload_cmd
=
'rsync -arz -e
\'
%s
\'
'
%
def_ssh
except
utils_path
.
CmdNotFoundError
:
def_upload_cmd
=
None
parser
.
add_argument
(
'--result-upload-cmd'
,
dest
=
'result_upload_cmd'
,
default
=
def_upload_cmd
,
help
=
'Specify the command to upload results'
)
def
run
(
self
,
args
):
url
=
getattr
(
args
,
'result_upload_url'
,
None
)
if
url
is
None
:
url
=
settings
.
get_value
(
'plugins.result_upload'
,
'url'
,
default
=
None
)
if
url
is
not
None
:
args
.
result_upload_url
=
url
cmd
=
getattr
(
args
,
'result_upload_cmd'
,
None
)
if
cmd
is
None
:
cmd
=
settings
.
get_value
(
'plugins.result_upload'
,
'command'
,
default
=
None
)
if
cmd
is
not
None
:
args
.
result_upload_cmd
=
cmd
optional_plugins/result_upload/setup.py
0 → 100644
浏览文件 @
9c732dc5
#!/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright: Virtuozzo Inc. 2017
# Authors: Dmitry Monakhov <dmonakhov@openvz.org>
from
setuptools
import
setup
,
find_packages
setup
(
name
=
'avocado-framework-plugin-result-upload'
,
description
=
'Avocado Plugin to propagate Job results to remote host'
,
version
=
open
(
"VERSION"
,
"r"
).
read
().
strip
(),
author
=
'Avocado Developers'
,
author_email
=
'avocado-devel@redhat.com'
,
url
=
'http://avocado-framework.github.io/'
,
packages
=
find_packages
(),
include_package_data
=
True
,
install_requires
=
[
'avocado-framework'
],
entry_points
=
{
'avocado.plugins.cli'
:
[
'results_upload = avocado_result_upload:ResultUploadCLI'
,
],
'avocado.plugins.result'
:
[
'results_upload = avocado_result_upload:ResultUpload'
,
]})
python-avocado.spec
浏览文件 @
9c732dc5
...
...
@@ -10,10 +10,10 @@
%global gittar %{srcname}-%{version}.tar.gz
%else
%if ! 0%{?commit:1}
%global commit
4aabc6a21ddfe741ba914b24902f24a23a9cda65
%global commit
cf93b03d1b5693f9853bcf123c218074e90ae3f9
%endif
%if ! 0%{?commit_date:1}
%global commit_date 20171
020
%global commit_date 20171
215
%endif
%global shortcommit %(c=%{commit};echo ${c:0:8})
%global gitrel .%{commit_date}git%{shortcommit}
...
...
@@ -29,7 +29,7 @@
Summary: Framework with tools and libraries for Automated Testing
Name: python-%{srcname}
Version: 56.0
Release:
0
%{?gitrel}%{?dist}
Release:
1
%{?gitrel}%{?dist}
License: GPLv2
Group: Development/Tools
URL: http://avocado-framework.github.io/
...
...
@@ -144,6 +144,9 @@ popd
pushd optional_plugins/varianter_pict
%{__python} setup.py build
popd
pushd optional_plugins/result_upload
%{__python} setup.py build
popd
%{__make} man
%install
...
...
@@ -175,6 +178,9 @@ popd
pushd optional_plugins/varianter_pict
%{__python} setup.py install --root %{buildroot} --skip-build
popd
pushd optional_plugins/result_upload
%{__python} setup.py install --root %{buildroot} --skip-build
popd
%{__mkdir} -p %{buildroot}%{_mandir}/man1
%{__install} -m 0644 man/avocado.1 %{buildroot}%{_mandir}/man1/avocado.1
%{__install} -m 0644 man/avocado-rest-client.1 %{buildroot}%{_mandir}/man1/avocado-rest-client.1
...
...
@@ -210,6 +216,9 @@ popd
pushd optional_plugins/varianter_pict
%{__python} setup.py develop --user
popd
pushd optional_plugins/result_upload
%{__python} setup.py develop --user
popd
# Package build environments have the least amount of resources
# we have observed so far. Let's avoid tests that require too
# much resources or are time sensitive
...
...
@@ -249,6 +258,7 @@ AVOCADO_CHECK_LEVEL=0 selftests/run
%exclude %{python_sitelib}/avocado_golang*
%exclude %{python_sitelib}/avocado_varianter_yaml_to_mux*
%exclude %{python_sitelib}/avocado_varianter_pict*
%exclude %{python_sitelib}/avocado_result_upload*
%exclude %{python_sitelib}/avocado_framework_plugin_result_html*
%exclude %{python_sitelib}/avocado_framework_plugin_runner_remote*
%exclude %{python_sitelib}/avocado_framework_plugin_runner_vm*
...
...
@@ -258,6 +268,7 @@ AVOCADO_CHECK_LEVEL=0 selftests/run
%exclude %{python_sitelib}/avocado_framework_plugin_varianter_pict*
%exclude %{python_sitelib}/avocado_framework_plugin_loader_yaml*
%exclude %{python_sitelib}/avocado_framework_plugin_golang*
%exclude %{python_sitelib}/avocado_framework_plugin_result_upload*
%{_libexecdir}/avocado/avocado-bash-utils
%{_libexecdir}/avocado/avocado_debug
%{_libexecdir}/avocado/avocado_error
...
...
@@ -398,6 +409,18 @@ Pair-Wise algorithms, also known as Combinatorial Independent Testing.
%{python_sitelib}/avocado_varianter_pict*
%{python_sitelib}/avocado_framework_plugin_varianter_pict*
%package plugins-result-upload
Summary: Avocado Plugin to propagate Job results to a remote host
Requires: %{name} == %{version}
%description plugins-result-upload
This optional plugin is intended to upload the Avocado Job results to
a dedicated sever.
%files plugins-result-upload
%{python_sitelib}/avocado_result_upload*
%{python_sitelib}/avocado_framework_plugin_result_upload*
%package examples
Summary: Avocado Test Framework Example Tests
Requires: %{name} == %{version}
...
...
@@ -417,6 +440,9 @@ examples of how to write tests on your own.
%{_datadir}/avocado/varianter_pict
%changelog
* Fri Dec 15 2017 Cleber Rosa <cleber@redhat.com> - 56.0-1
- Added result_upload plugin
* Tue Nov 21 2017 Cleber Rosa <cleber@redhat.com> - 56.0-0
- New upstream release
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录