博主是在OpenStack Juno版本上安装测试
安装
目前Tempest没有打成包,需要用源码方式安装
×××
# git clone https://github.com/openstack/tempest.git
修改requirement的文件
# cd tempest # echo "discover>=0.4.0" >> requirements.txt
安装依赖包
# yum install gcc libxslt-devel ibevent-devel openssl-devel libffi-devel python-devel python-pip python-virtualenv # pip install pbr
安装
# python setup.py install
配置
copy配置文件
# cp etc/tempest.conf.sample etc/tempest.conf
修改配置文件中的相应配置项
这边配置项视需要测试的项目会有不同,可以参考redhat相应文档或者OpenStack官网进行配置。
本文以一次配置为例说明
# egrep -v '^#|^$' etc/tempest.conf [DEFAULT] lock_path=keystone [auth] [baremetal] [boto] [cli] [compute] [compute-feature-enabled] [dashboard] [data_processing] [data_processing-feature-enabled] [database] [debug] [identity] endpoint_type=publicURL catalog_type=identity uri = http://controller:5000/v2.0 uri_v3 = http://controller:5000/v3.0 auth_version = v2 username = admin tenant_name = admin admin_role = admin password = admin admin_username = admin admin_tenant_name = admin admin_password = admin [identity-feature-enabled] api_v2 = true [p_w_picpath] [p_w_picpath-feature-enabled] [input-scenario] [messaging] [negative] [network] [network-feature-enabled] [object-storage] [object-storage-feature-enabled] [orchestration] [oslo_concurrency] [scenario] [service_available] [stress] [telemetry] [volume] [volume-feature-enabled]
运行
可以通过脚本(testr)或者nosetests来运行测试。
使用脚本运行
可以直接运行Tempest目录下的脚本(-V是用虚拟环境运行):
# ./run_tempest.sh -V
使用nosetests运行
安装nosetests和junitxml
# yum install python-nose-exclude # pip install junitxml
运行命令
测试v2接口的tokens
# nosetests tempest/api/identity/admin/v2/test_tokens.py --with-xunit --xunit-file=/root/keystone_test_tokens.xml
上述的目录或文件按实际测试需求去添加。 --with-xunit --xunit-file两个参数是指将结果以xml格式输出到指定文件。
转载于:https://blog.51cto.com/einst/1623376