Merge "Support passing pool to functional tests"

This commit is contained in:
Zuul 2019-12-13 23:26:05 +00:00 committed by Gerrit Code Review
commit d81fbeb3a9
6 changed files with 17 additions and 3 deletions

View File

@ -64,6 +64,7 @@ class BaseFunctTestCase(unittest2.TestCase):
LOGGING_ENABLED = get_bool_env('CL_FTEST_LOGGING', False)
ROOT_HELPER = os.environ.get('CL_FTEST_ROOT_HELPER', 'sudo')
MEMORY_PERSISTENCE = get_bool_env('CL_FTEST_MEMORY_PERSISTENCE', True)
DEFAULT_POOL = os.environ.get('CL_FTEST_POOL_NAME', None)
tests_config = None
@classmethod
@ -174,6 +175,7 @@ class BaseFunctTestCase(unittest2.TestCase):
vol_size = kwargs.setdefault('size', 1)
name = kwargs.setdefault('name', backend.id)
kwargs.setdefault('pool_name', self.DEFAULT_POOL)
vol = backend.create_volume(**kwargs)

View File

@ -109,7 +109,7 @@ Some of the fields we could be interested in are:
- `host`: Used to store the backend name information together with the host
name where cinderlib is running. This information is stored as a string in
the form of *host@backend#pool*. This is an optional parameter, and passing
it to `create_volume` will override default value, allowing us caller to
it to `create_volume` will override default value, allowing our caller to
request a specific pool for multi-pool backends, though we recommend using
the `pool_name` parameter instead. Issues will arise if parameter doesn't
contain correct information.

View File

@ -169,6 +169,11 @@ functional tests using environmental variables:
- ``CL_FTEST_CFG```: Location of the configuration file. Defaults to
``/etc/cinder/cinder.conf``.
- ``CL_FTEST_POOL_NAME``: If our backend has multi-pool support and we have
configured multiple pools we can use this parameter to define which pool to
use for the functional tests. If not defined it will use the first reported
pool.
If we encounter problems while running the functional tests, but the *Cinder*
service is running just fine, we can go to the #openstack-cinder IRC channel in
Freenode, or send an email to the `discuss-openstack mailing list`_ starting
@ -371,8 +376,8 @@ provisioning- on a per volume basis.
*Cinderlib* supports these features, but since they are driver specific, there
is no automated testing in *cinderlib*'s functional tests; but we can test them
them manually ourselves using the ``extra_specs``, ``qos_specs`` and
``pool_name`` parameters in the ``create_volume`` and ``clone`` methods.
manually ourselves using the ``extra_specs``, ``qos_specs`` and ``pool_name``
parameters in the ``create_volume`` and ``clone`` methods.
We can see the list of available pools in multi-pool drivers on the
``pool_names`` property in the Backend instance.

View File

@ -21,3 +21,8 @@ Run cinderlib tests
:default: sudo
The command used by the tests to gain root capabilities.
.. zuul:rolevar:: cinderlib_pool_name
:default: The first pool reported by the backend
Pool name used to create volumes.

View File

@ -7,3 +7,4 @@
tox_environment:
CL_FTEST_CFG: "{{ cinderlib_config_file }}"
CL_FTEST_ROOT_HELPER: "{{ cinderlib_root_helper }}"
CL_FTEST_POOL_NAME: "{{ cinderlib_pool_name }}"

View File

@ -32,6 +32,7 @@ passenv = *_proxy *_PROXY
[testenv:functional]
usedevelop=True
basepython=python2.7
passenv = CL_FTEST_POOL_NAME
setenv = OS_TEST_PATH=./cinderlib/tests/functional
CL_FTEST_CFG={env:CL_FTEST_CFG:{toxinidir}/cinderlib/tests/functional/lvm.yaml}
CL_FTEST_ROOT_HELPER={env:CL_FTEST_ROOT_HELPER:{toxinidir}/tools/virtualenv-sudo.sh}