安装
git clone https://git.openstack.org/openstack/tempest cd tempest python setup.py install pip install -r requirements.txt -r test-requirements.txt
- 1
- 2
- 3
- 4
生成配置文件模版
在tempest仓库下执行命令
tox -e genconfig
- 1
会在etc文件夹下生成tempest.conf.sample配置文件模版
初始化
确定测试环境目录,例如/opt目录,在/opt目录下执行命令
tempest init tempest-test-dir
- 1
会在/opt目录下生成tempest-test-dir测试文件夹,文件夹结构
[root@controller tempest-test-dir]# tree . ├── etc │ ├── tempest.conf │ └── tempest.conf.sample ├── logs └── tempest_lock 3 directories, 2 files
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
修改配置文件
修改测试文件夹下的etc/tempest.conf文件,主要包括修改认证信息、镜像信息、网络信息等。详细配置请参考tempest开发者文档
执行测试
需要在测试文件夹下运行测试,有几种方法可以运行测试
1.
testr run
- 1
2. 并发测试
testr run --parallel
- 1
3. 测试指定用例
testr run tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_reboot_non_existent_server
- 1
4. 调试运行
在指定测试用例中加入断点,使用命令调试运行
python -m testtools.run <path_of_testcase>
- 1
附加:使用devstack安装时,tempest生成的默认配置
[network] default_network = 10.0.0.0/22 public_router_id = public_network_id = ee33d8a6-352d-45fa-816e-ee4308cafc92 project_networks_reachable = false project_network_cidr = 10.0.0.0/22 [DEFAULT] debug = True log_file = tempest.log use_stderr = False use_syslog = False [oslo_concurrency] lock_path = /opt/stack/data/tempest [compute] max_microversion = latest flavor_ref_alt = 84 flavor_ref = 42 image_ref_alt = 32144ff5-8e39-487b-8053-db10441c6254 image_ref = 32144ff5-8e39-487b-8053-db10441c6254 build_timeout = 196 [volume] max_microversion = latest build_timeout = 196 [identity] auth_version = v3 admin_domain_scope = True user_unique_last_password_count = 2 user_lockout_duration = 5 user_lockout_failure_attempts = 2 uri_v3 = http://192.168.221.128/identity/v3 uri = http://192.168.221.128/identity/v2.0/ [auth] use_dynamic_credentials = True tempest_roles = Member admin_domain_name = Default admin_project_name = admin admin_password = admin admin_username = admin [identity-feature-enabled] forbid_global_implied_dsr = True security_compliance = True api_v2 = True [image-feature-enabled] api_v1 = False deactivate_image = True [validation] network_for_ssh = private image_ssh_user = cirros ssh_timeout = 196 ip_version_for_ssh = 4 run_validation = False connect_method = floating [compute-feature-enabled] swap_volume = True vnc_console = True attach_encrypted_volume = True block_migration_for_live_migration = False change_password = False live_migration = False resize = True personality = False [network-feature-enabled] api_extensions = address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dvr,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,flavors,l3-flavors,l3-ha,l3_agent_scheduler,multi-provider,net-mtu,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,quotas,rbac-policies,router,router_availability_zone,security-group,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-timestamp,subnet-service-types,subnet_allocation,tag,tag-ext port_security = True ipv6_subnet_attributes = True ipv6 = True [scenario] img_file = cirros-0.3.5-x86_64-disk.img img_dir = /opt/stack/devstack/files [volume-feature-enabled] api_extensions = all backup = False api_v1 = False api_v3 = True manage_volume = True manage_snapshot = True [service_available] trove = False ironic = False sahara = False horizon = True ceilometer = False heat = False swift = False cinder = True neutron = True nova = True glance = True key = True [object-storage-feature-enabled] discoverable_apis = all