Merge "Add a env var to use in-memory obj server in func"
This commit is contained in:
commit
ac22c5eadf
@ -51,6 +51,25 @@ To execute the unit tests:
|
|||||||
|
|
||||||
- `tox -e pep8,py26`
|
- `tox -e pep8,py26`
|
||||||
|
|
||||||
|
The functional tests may be executed against a :doc:`development_saio` or
|
||||||
|
other running Swift cluster using the command:
|
||||||
|
|
||||||
|
- `tox -e func`
|
||||||
|
|
||||||
|
The endpoint and authorization credentials to be used by functional tests
|
||||||
|
should be configured in the ``test.conf`` file as described in the section
|
||||||
|
:ref:`setup_scripts`.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
------------
|
------------
|
||||||
Coding Style
|
Coding Style
|
||||||
------------
|
------------
|
||||||
@ -78,7 +97,7 @@ The documentation in docstrings should follow the PEP 257 conventions
|
|||||||
|
|
||||||
More specifically:
|
More specifically:
|
||||||
|
|
||||||
1. Triple qutes should be used for all docstrings.
|
1. Triple quotes should be used for all docstrings.
|
||||||
2. If the docstring is simple and fits on one line, then just use
|
2. If the docstring is simple and fits on one line, then just use
|
||||||
one line.
|
one line.
|
||||||
3. For docstrings that take multiple lines, there should be a newline
|
3. For docstrings that take multiple lines, there should be a newline
|
||||||
@ -117,3 +136,4 @@ another year added, and date ranges are not needed.::
|
|||||||
# implied.
|
# implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
@ -398,6 +398,8 @@ commands are as follows:
|
|||||||
|
|
||||||
.. literalinclude:: /../saio/swift/object-server/4.conf
|
.. literalinclude:: /../saio/swift/object-server/4.conf
|
||||||
|
|
||||||
|
.. _setup_scripts:
|
||||||
|
|
||||||
------------------------------------
|
------------------------------------
|
||||||
Setting up scripts for running Swift
|
Setting up scripts for running Swift
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
@ -395,5 +395,5 @@ class DiskFile(object):
|
|||||||
:param timestamp: timestamp to compare with each file
|
:param timestamp: timestamp to compare with each file
|
||||||
"""
|
"""
|
||||||
fp, md = self._filesystem.get_object(self._name)
|
fp, md = self._filesystem.get_object(self._name)
|
||||||
if md['X-Timestamp'] < Timestamp(timestamp):
|
if md and md['X-Timestamp'] < Timestamp(timestamp):
|
||||||
self._filesystem.del_object(self._name)
|
self._filesystem.del_object(self._name)
|
||||||
|
@ -48,7 +48,7 @@ from swift.common.utils import config_true_value
|
|||||||
from swift.proxy import server as proxy_server
|
from swift.proxy import server as proxy_server
|
||||||
from swift.account import server as account_server
|
from swift.account import server as account_server
|
||||||
from swift.container import server as container_server
|
from swift.container import server as container_server
|
||||||
from swift.obj import server as object_server
|
from swift.obj import server as object_server, mem_server as mem_object_server
|
||||||
import swift.proxy.controllers.obj
|
import swift.proxy.controllers.obj
|
||||||
|
|
||||||
# In order to get the proper blocking behavior of sockets without using
|
# In order to get the proper blocking behavior of sockets without using
|
||||||
@ -133,6 +133,7 @@ max_file_size = %d
|
|||||||
|
|
||||||
def in_process_setup(the_object_server=object_server):
|
def in_process_setup(the_object_server=object_server):
|
||||||
print >>sys.stderr, 'IN-PROCESS SERVERS IN USE FOR FUNCTIONAL TESTS'
|
print >>sys.stderr, 'IN-PROCESS SERVERS IN USE FOR FUNCTIONAL TESTS'
|
||||||
|
print >>sys.stderr, 'Using object_server: %s' % the_object_server.__name__
|
||||||
|
|
||||||
monkey_patch_mimetools()
|
monkey_patch_mimetools()
|
||||||
|
|
||||||
@ -408,7 +409,10 @@ def setup_package():
|
|||||||
config.update(get_config('func_test'))
|
config.update(get_config('func_test'))
|
||||||
|
|
||||||
if in_process:
|
if in_process:
|
||||||
in_process_setup()
|
in_mem_obj_env = os.environ.get('SWIFT_TEST_IN_MEMORY_OBJ')
|
||||||
|
in_mem_obj = utils.config_true_value(in_mem_obj_env)
|
||||||
|
in_process_setup(the_object_server=(
|
||||||
|
mem_object_server if in_mem_obj else object_server))
|
||||||
|
|
||||||
global web_front_end
|
global web_front_end
|
||||||
web_front_end = config.get('web_front_end', 'integral')
|
web_front_end = config.get('web_front_end', 'integral')
|
||||||
|
Loading…
Reference in New Issue
Block a user