Merge "Enable in-process func tests to optionally use fast-post"

This commit is contained in:
Jenkins 2016-02-11 08:29:56 +00:00 committed by Gerrit Code Review
commit bf4c26d7ef
3 changed files with 38 additions and 4 deletions

View File

@ -83,15 +83,35 @@ For example, this command would run the functional tests using policy
SWIFT_TEST_POLICY=silver tox -e func
In-process functional testing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If the ``test.conf`` file is not found then the functional test framework will
instantiate a set of Swift servers in the same process that executes the
functional tests. This 'in-process test' mode may also be enabled (or disabled)
by setting the environment variable ``SWIFT_TEST_IN_PROCESS`` to a true (or
false) value prior to executing `tox -e func`.
When using the 'in-process test' mode, the optional in-memory
object server may be selected by setting the environment variable
``SWIFT_TEST_IN_MEMORY_OBJ`` to a true value.
When using the 'in-process test' mode some server configuration options may be
set using environment variables:
- the optional in-memory object server may be selected by setting the
environment variable ``SWIFT_TEST_IN_MEMORY_OBJ`` to a true value.
- the proxy-server ``object_post_as_copy`` option may be set using the
environment variable ``SWIFT_TEST_IN_PROCESS_OBJECT_POST_AS_COPY``.
For example, this command would run the in-process mode functional tests with
the proxy-server using object_post_as_copy=False (the 'fast-POST' mode)::
SWIFT_TEST_IN_PROCESS=1 SWIFT_TEST_IN_PROCESS_OBJECT_POST_AS_COPY=False \
tox -e func
This particular example may also be run using the ``func-in-process-fast-post``
tox environment::
tox -e func-in-process-fast-post
The 'in-process test' mode searches for ``proxy-server.conf`` and
``swift.conf`` config files from which it copies config options and overrides
@ -127,7 +147,7 @@ using config files found in ``$HOME/my_tests`` and policy 'silver'::
Coding Style
------------
Swift use flake8 with the OpenStack `hacking`_ module to enforce
Swift uses flake8 with the OpenStack `hacking`_ module to enforce
coding style.
Install flake8 and hacking with pip or by the packages of your

View File

@ -388,6 +388,15 @@ def in_process_setup(the_object_server=object_server):
'SERVICE_require_group': 'service'
})
# If an env var explicitly specifies the proxy-server object_post_as_copy
# option then use its value, otherwise leave default config unchanged.
object_post_as_copy = os.environ.get(
'SWIFT_TEST_IN_PROCESS_OBJECT_POST_AS_COPY')
if object_post_as_copy is not None:
object_post_as_copy = config_true_value(object_post_as_copy)
config['object_post_as_copy'] = str(object_post_as_copy)
_debug('Setting object_post_as_copy to %r' % object_post_as_copy)
acc1lis = eventlet.listen(('localhost', 0))
acc2lis = eventlet.listen(('localhost', 0))
con1lis = eventlet.listen(('localhost', 0))

View File

@ -44,6 +44,11 @@ commands =
[testenv:func]
commands = ./.functests {posargs}
[testenv:func-in-process-fast-post]
commands = ./.functests {posargs}
setenv = SWIFT_TEST_IN_PROCESS=1
SWIFT_TEST_IN_PROCESS_OBJECT_POST_AS_COPY=False
[testenv:venv]
commands = {posargs}