Update functional test docs

Add individual configuration sections for devstack and non-devstack.
Fix some spelling/grammer mistakes.
Simplify examples and remove special section for functional-api tests.

Change-Id: Ia8c9fd1f8c27dbeb2811a5da55189ea837a8fa14
Partially-Implements: blueprint magnum-tempest
This commit is contained in:
Corey O'Brien 2016-01-25 17:25:51 -06:00
parent ca8268f8b9
commit c377a56285
1 changed files with 70 additions and 33 deletions

View File

@ -1,6 +1,6 @@
===========================
Run functional test locally
===========================
========================
Running functional tests
========================
This is a guide for developers who want to run functional tests in their local
machine.
@ -8,20 +8,22 @@ machine.
Prerequisite
============
You need to follow the developer quickstart guide to deploy Magnum in a
devstack environment
You need to have a Magnum instance running somewhere. If you are using
devstack, follow the developer quickstart guide to deploy Magnum in a devstack
environment
`<http://docs.openstack.org/developer/magnum/dev/quickstart.html>`_
Preparation
===========
Configuration
=============
The functional tests require a couple configuration files, so you'll need to
generate them yourself.
Navigate to Magnum directory::
For devstack
------------
If you're using devstack, you can copy and modify the devstack configuration::
cd /opt/stack/magnum
Prepare a config file for functional test::
cp /opt/stack/tempest/etc/tempest.conf /opt/stack/magnum/etc/tempest.conf
cp functional_creds.conf.sample functional_creds.conf
@ -52,33 +54,68 @@ before and their versions become too old::
UPPER_CONSTRAINTS=/opt/stack/requirements/upper-constraints.txt
sudo pip install -c $UPPER_CONSTRAINTS -U -r test-requirements.txt
Run the test
============
Outside of devstack
-------------------
If you are not using devstack, you'll need to create the configuration files.
The /etc/tempest.conf configuration file is documented here
We'v splited functional testing per COE.
`<http://docs.openstack.org/developer/tempest/configuration.html#tempest-configuration>`_
Use follow command lines to check what functional testing is supported::
Here's a reasonable sample of tempest.conf settings you might need::
[auth]
use_dynamic_credentials=False
test_accounts_file=/tmp/etc/magnum/accounts.yaml
admin_username=admin
admin_password=password
admin_tenant_name=admin
[identity]
disable_ssl_certificate_validation=True
uri=https://identity.example.com/v2.0
auth_version=v2
region=EAST
[identity-feature-enabled]
api_v2 = true
api_v3 = false
trust = false
[oslo_concurrency]
lock_path = /tmp/
[magnum]
image_id=22222222-2222-2222-2222-222222222222
nic_id=11111111-1111-1111-1111-111111111111
keypair_id=default
flavor_id=small
magnum_url=https://magnum.example.com/v1
[debug]
trace_requests=true
A sample functional_creds.conf can be found in the root of this project named
functional_creds.conf.sample
When you run tox, be sure to specify the location of your tempest.conf using
TEMPEST_CONFIG_DIR::
export TEMPEST_CONFIG_DIR=/tmp/etc/magnum/
tox -e functional-api
Execution
=========
Magnum has different functional tests for each COE and for the API.
All the environments are detailed in Magnum's tox.ini::
cd /opt/stack/magnum
cat tox.ini | grep functional- | awk -F: '{print $2}' | sed s/]//
To do some specify functional testing, for example, test kubernetes functional
cases::
To run a particular subset of tests, specify that group as a tox environment.
For example, here is how you would run all of the kubernates tests::
tox -e functional-k8s -- --concurrency=1
tox -e functional-k8s
Test specified case of kubernetes functional cases::
To run a specific test or group of tests, specify the test path as a positional argument::
tox -e functional-k8s -- --concurrency=1 <test path>
The following is an example for test path::
magnum.tests.functional.k8s.v1.test_k8s_python_client.TestBayModelResource.test_baymodel_create_and_delete
We also have api tests being added. To run those, go to
tempest directory (tempest is installed with devstack by default), install
magnum, and execute tempest tox::
cd /opt/stack/tempest
tox -eall-plugin magnum.tests.functional.api.v1 -- --concurrency=1
tox -e functional-k8s -- magnum.tests.functional.k8s.v1.test_k8s_python_client.TestBayModelResource