tempest - dianaclarke/openstack-notes GitHub Wiki
- Links
- https://github.com/openstack/tempest#quickstart
- http://docs.openstack.org/developer/tempest/configuration.html#tempest-configuration
- http://www.rushiagr.com/blog/2013/03/20/openstack-tempest-quick-start-with-devstack/
- http://blog.coolsvap.net/2014/04/28/writing-my-first-openstack-tempest-test-case/
- http://www.tech-thoughts-blog.com/2013/08/licstart-following-is-entire-license.html?m=1
- https://dague.net//presentations/tempest-101/#/
- https://docs.google.com/presentation/d/1M3XhAco_0u7NZQn3Gz53z9VOHHrkQBzEs5gt43ZvhOc/edit?usp=sharing
- On a VM with devstack (already stacked):
This is your host IP address: 192.168.122.82
This is your host IPv6 address: ::1
Horizon is now available at http://192.168.122.82/dashboard
Keystone is serving at http://192.168.122.82:5000/
The default users are: admin and demo
The password: 123456
- Grab the tempest repo & initialize it:
$ git clone http://git.openstack.org/openstack/tempest
$ sudo pip install --upgrade tempest/
$ tempest init cloud-01
$ cd cloud-01/
- Here's what the conf looks like initially:
$ cat etc/tempest.conf
[DEFAULT]
log_dir = /home/diana/cloud-01/logs
log_file = tempest.log
[oslo_concurrency]
lock_path = /home/diana/cloud-01/tempest_lock
- Overwrite that config with the tempest config devstack kindly creates for you:
$ cp etc/tempest.conf etc/tempest.conf.bak
$ cp /opt/stack/tempest/etc/tempest.conf etc/tempest.conf
$ cat etc/tempest.conf
[DEFAULT]
debug = True
log_file = tempest.log
use_stderr = False
use_syslog = False
[oslo_concurrency]
lock_path = /opt/stack/data/tempest
[compute]
fixed_network_name = private
ssh_connect_method = floating
flavor_ref_alt = 84
flavor_ref = 42
image_alt_ssh_user = cirros
image_ref_alt = ec3cbb5e-0ce8-4faa-96bd-cfa385122d9a
image_ref = ec3cbb5e-0ce8-4faa-96bd-cfa385122d9a
ssh_user = cirros
build_timeout = 196
[volume]
build_timeout = 196
[identity]
auth_version = v2
uri_v3 = http://192.168.122.82:5000/v3
uri = http://192.168.122.82:5000/v2.0/
[auth]
use_dynamic_credentials = True
tempest_roles = Member
admin_domain_name = Default
admin_tenant_id = 162df2e9319041029c8886f07911e9c7
admin_tenant_name = admin
admin_password = 123456
admin_username = admin
[image-feature-enabled]
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]
api_extensions = all
allow_duplicate_networks = True
attach_encrypted_volume = True
live_migrate_paused_instances = True
preserve_ports = True
block_migration_for_live_migration = False
change_password = False
live_migration = False
resize = True
max_microversion = latest
[network]
default_network = 10.0.0.0/24
public_router_id =
public_network_id =
tenant_networks_reachable = false
api_version = 2.0
[network-feature-enabled]
api_extensions = all
ipv6_subnet_attributes = True
ipv6 = True
[scenario]
large_ops_number = 0
img_file = cirros-0.3.4-x86_64-disk.img
aki_img_file = cirros-0.3.4-x86_64-vmlinuz
ari_img_file = cirros-0.3.4-x86_64-initrd
ami_img_file = cirros-0.3.4-x86_64-blank.img
img_dir = /home/diana/devstack/files/images/cirros-0.3.4-x86_64-uec
[telemetry-feature-enabled]
events = True
[volume-feature-enabled]
api_extensions = all
backup = False
volume_services = True
incremental_backup_force = True
[dashboard]
dashboard_url = http://192.168.122.82/
[cli]
cli_dir = /usr/bin
[service_available]
trove = False
ironic = False
sahara = False
horizon = True
ceilometer = False
heat = False
swift = False
cinder = True
neutron = False
nova = True
glance = True
key = True
[object-storage-feature-enabled]
discoverable_apis = all
- Now make sure you can run the tempest tests before adding your own. I had 3 failing tests locally, not sure why, but at least I can pretty safely ignore them (since they pre-date any changes I'm about to make).
$ ostestr --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario))'
======
Totals
======
Ran: 1148 tests in 3872.0000 sec.
- Passed: 1008
- Skipped: 137
- Expected Fail: 0
- Unexpected Success: 0
- Failed: 3
Sum of execute time for each test: 6793.8867 sec.
- The failing test logs: http://pastebin.com/vaTk0cUE
tempest.api.compute.admin.test_migrations.MigrationsAdminTest.test_resize_server_revert_deleted_flavor[id-33f1fec3-ba18-4470-8e4e-1d888e7c3593]
tempest.api.compute.certificates.test_certificates.CertificatesV2TestJSON.test_create_root_certificate[id-c070a441-b08e-447e-a733-905909535b1b]
tempest.api.compute.certificates.test_certificates.CertificatesV2TestJSON.test_get_root_certificate[id-3ac273d0-92d2-4632-bdfc-afbc21d4606c]
-
Tips from IRC:
- mriedem said to check out the
test_volume_boot_pattern
test for examples of sshing to the guest to verify something. FYI - That test takes about 6/7 minutes to run. - He also said to check out the
test_resize_volume_backed_server_confirm
test scenerio intest_server_advanced_ops
: - https://github.com/openstack/tempest/blob/534a8dc60dfef116156b8f9ee60071a9bf4e4f90/tempest/scenario/test_volume_boot_pattern.py#L112
- https://github.com/openstack/tempest/blob/4982cde29f2ea5c8a87f2c958a3d800c63ef89bc/tempest/scenario/test_server_advanced_ops.py#L54
- mriedem said to check out the
-
You can also run one tempest test at a time:
$ time testr run tempest.scenario.test_volume_boot_pattern
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-500} \
${PYTHON:-python} -m subunit.run discover -t /usr/lib/python2.7/site-packages/tempest /usr/lib/python2.7/site-packages/tempest/test_discover --list
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-500} \
${PYTHON:-python} -m subunit.run discover -t /usr/lib/python2.7/site-packages/tempest /usr/lib/python2.7/site-packages/tempest/test_discover --load-list /tmp/tmpgyEfyS
Ran 4 (+3) tests in 389.996s (+356.820s)
PASSED (id=5)
real 6m33.995s
user 0m5.679s
sys 0m0.645s
$ time testr run tempest.scenario.test_server_advanced_ops
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-500} \
${PYTHON:-python} -m subunit.run discover -t /home/diana/envs/tempest/lib/python2.7/site-packages/tempest /home/diana/envs/tempest/lib/python2.7/site-packages/tempest/test_discover --list
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-500} \
${PYTHON:-python} -m subunit.run discover -t /home/diana/envs/tempest/lib/python2.7/site-packages/tempest /home/diana/envs/tempest/lib/python2.7/site-packages/tempest/test_discover --load-list /tmp/tmpcLn88K
Ran 2 (+2) tests in 92.156s
PASSED (id=8)
real 1m35.014s
user 0m2.870s
sys 0m0.365s
- The tempest config defines two flavors you can use during a test. Those flavors against devstack are:
flavor_ref_alt = 84
flavor_ref = 42
$ nova flavor-show 42
+----------------------------+---------+
| Property | Value |
+----------------------------+---------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 0 |
| extra_specs | {} |
| id | 42 |
| name | m1.nano |
| os-flavor-access:is_public | True |
| ram | 64 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+---------+
$ nova flavor-show 84
+----------------------------+----------+
| Property | Value |
+----------------------------+----------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 0 |
| extra_specs | {} |
| id | 84 |
| name | m1.micro |
| os-flavor-access:is_public | True |
| ram | 128 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+----------+
-
Neither of these flavors use swap or ephemeral disks. Can I create new flavors in tempest tests?
-
What about this test? Anything useful here?
def test_baremetal_server_ops(self):
...
# We expect the ephemeral partition to be mounted on /mnt and to have
# the same size as our flavor definition.
eph_size = self.get_flavor_ephemeral_size()
if eph_size:
self.verify_partition(vm_client, 'ephemeral0', '/mnt', eph_size)
verify_partition
: https://github.com/openstack/tempest/blob/dcc559792320d6cd087f658a3c49a88104493dc5/tempest/scenario/test_baremetal_basic_ops.py#L43
$ ssh [email protected]
[email protected]'s password:
$ blkid
/dev/vda: LABEL="cirros-rootfs" UUID="d42bb4a4-04bb-49b0-8821-5b813116b17b" SEC_TYPE="ext2" TYPE="ext3"
/dev/vdb: LABEL="ephemeral0" UUID="0bdcb911-a286-4bf4-af16-83c3b34a440a" TYPE="ext4"
/dev/sr0: LABEL="config-2" TYPE="iso9660"
/dev/vdc: UUID="b21cb6c1-13d9-4f71-b3d0-31ecf573fa5b" TYPE="swap"
- Might need something like this later:
flavor = self.flavors_admin_client.show_flavor(
self.flavor_ref)['flavor']
flavor = self.flavors_admin_client.create_flavor(
name=data_utils.rand_name('test_resize_flavor_'),
ram=flavor['ram'],
disk=flavor['disk'],
vcpus=flavor['vcpus']
)['flavor']
self.addCleanup(self._flavor_clean_up, flavor['id'])
- Change the flavors in devstack?