测试环境: OpenStack Juno
Centos 7.1 x86_64
# 从git上下载源码
[root@node-27 home(keystone_admin)]# git clone https://github.com/openstack/tempest.git
# 安装依赖包
[root@node-27 home(keystone_admin)]# yum install gcc libxslt-devel openssl-devel \
libffi-devel python-devel python-pip python-virtualenv
[root@node-27 home(keystone_admin)]# cd tempest
[root@node-27 home(keystone_admin)]# python setup.py install # 安装
# 生成etc/tempest.conf.sample文件,这个是根据tempest/config.py来生成的
[root@node-27 tempest(keystone_admin)]# tox -egenconfig
[root@node-27 tempest(keystone_admin)]# cp etc/{tempest.conf.sample,tempest.conf}
# 还有一种生成tempest.conf的方法(官方不推荐这种)
[root@node-27 tempest(keystone_admin)]# oslo-config-generator --config-file \
tools/config/config-generator.tempest.conf \
--output-file etc/tempest.conf
# 修改etc/tempest.conf配置文件
[root@node-27 tempest(keystone_admin)]# egrep -v '^#|^$' etc/tempest.conf # 这里只是个测试样例
[DEFAULT]
debug = true
log_file = tempest.log
[auth]
tempest_roles = Member
[baremetal]
[boto]
[compute]
p_w_picpath_ref = 5b397b17-0bea-45d7-96bd-d1e9337e9c9e
p_w_picpath_ref_alt = 5b397b17-0bea-45d7-96bd-d1e9337e9c9e
p_w_picpath_ssh_user = cirros
p_w_picpath_ssh_password = "cubswin:)"
[compute-feature-enabled]
[dashboard]
dashboard_url = http://node
login_url = http://node/auth/login/
[data_processing]
[data_processing-feature-enabled]
[database]
[debug]
[identity]
uri = http://172.16.10.30:5000/v2.0/
region = regionOne
username = admin
tenant_name = admin
admin_role = admin
password = 99cloud
admin_username = admin
admin_tenant_name = admin
admin_password = 99cloud
[identity-feature-enabled]
api_v3 = false
[p_w_picpath]
http_p_w_picpath = http://node/repo_juno/Packages/cirros.img
[p_w_picpath-feature-enabled]
[input-scenario]
[messaging]
[negative]
[network]
public_network_id = bae9a60c-b507-43b5-a846-8aa9871f81e5
[network-feature-enabled]
ipv6 = false
[object-storage]
[object-storage-feature-enabled]
[orchestration]
[oslo_concurrency]
[scenario]
img_disk_format = qcow2
[service_available]
cinder = false
neutron = true
glance = true
swift = false
nova = true
heat = false
ceilometer = false
horizon = true
sahara = false
ironic = false
trove = false
zaqar = false
[stress]
[telemetry]
[telemetry-feature-enabled]
[validation]
[volume]
[volume-feature-enabled]
api_v2 = false
# 删除旧的虚拟环境
[root@node-27 tempest(keystone_admin)]# rm .venv -rf
# 生成一个新的虚拟环境,并对整个openstack进行功能性测试
[root@node-27 tempest(keystone_admin)]# ./run_tempest.sh -V # -V表示使用虚拟环境
No virtual environment found...create one? (Y/n) y # 这里选y
Creating venv... done.
。。。。。
# 如果你只想跑一个测试用例,考虑使用testr或nosetests
[root@node-27 tempest(keystone_admin)]# nosetests tempest/api/identity/admin/v2/test_services.py \
--with-xunit \
--xunit-file=/tmp/keystone_test_services.xml # --with-xunit --xunit-file 将结果以xml格式输出到指定文件,导入excel中显示
# 指定跑特定目录下的测试用例,-w: 指定目录,-d:具体错误
(.venv)[root@node-27 tempest(keystone_admin)]# nosetests -w tempest/api/network/admin/ -d
参考链接