summaryrefslogtreecommitdiff
path: root/test/functional/__init__.py
diff options
context:
space:
mode:
authorAlistair Coles <alistairncoles@gmail.com>2018-06-07 11:35:34 +0100
committerAlistair Coles <alistairncoles@gmail.com>2018-06-07 11:59:08 +0100
commit8b44c9df29572efca928c1d36fa3e7a90e94caa0 (patch)
tree3492ef07dd0c516608dceaf2dba4f5a1a8bb330a /test/functional/__init__.py
parent5acefa3dc909a0eed8d80a52dcff7131b4f0b878 (diff)
downloadswift-8b44c9df29572efca928c1d36fa3e7a90e94caa0.tar.gz
Allow domain remap storage_domain to be configured for func tests
Previously some tests in /test/functional/test_staticweb.py assumed that domain_remap middleware was configured with the default storage_domain 'example.com'. As a result those tests would fail if run against a cluster with domain_remap middleware installed but not having an 'example.com' storage_domain. This patch allows a storage_domain to be configured in the test.conf file so that the tests may be successfully run against any cluster. If the option is not set then the tests will be skipped. To ensure that the in process test job func-domain-remap-staticweb still runs all the tests in test_staticweb.py, its config loader is modified to add the required storage_domain option to the test config with the same value used by the domain_remap middleware. Related-Change: I6bc70039c1b99b8a5bf5a30e9c6877d4f0aa638d Co-Authored-By: Tim Burke <tim.burke@gmail.com> Change-Id: Ifab84fc3ef66b9790e96ebb8e5c8061a12636045
Diffstat (limited to 'test/functional/__init__.py')
-rw-r--r--test/functional/__init__.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/functional/__init__.py b/test/functional/__init__.py
index dcbc06483..37cf9bce5 100644
--- a/test/functional/__init__.py
+++ b/test/functional/__init__.py
@@ -381,26 +381,33 @@ def _load_domain_remap_staticweb(proxy_conf_file, swift_conf_file, **kwargs):
"""
_debug('Setting configuration for domain_remap')
+ # add a domain_remap storage_domain to the test configuration
+ storage_domain = 'example.net'
+ global config
+ config['storage_domain'] = storage_domain
+
# The global conf dict cannot be used to modify the pipeline.
# The pipeline loader requires the pipeline to be set in the local_conf.
# If pipeline is set in the global conf dict (which in turn populates the
# DEFAULTS options) then it prevents pipeline being loaded into the local
# conf during wsgi load_app.
# Therefore we must modify the [pipeline:main] section.
-
conf = ConfigParser()
conf.read(proxy_conf_file)
try:
section = 'pipeline:main'
old_pipeline = conf.get(section, 'pipeline')
pipeline = old_pipeline.replace(
- "tempauth",
- "domain_remap tempauth staticweb")
+ " tempauth ",
+ " domain_remap tempauth staticweb ")
if pipeline == old_pipeline:
raise InProcessException(
"Failed to insert domain_remap and staticweb into pipeline: %s"
% old_pipeline)
conf.set(section, 'pipeline', pipeline)
+ # set storage_domain in domain_remap middleware to match test config
+ section = 'filter:domain_remap'
+ conf.set(section, 'storage_domain', storage_domain)
except NoSectionError as err:
msg = 'Error problem with proxy conf file %s: %s' % \
(proxy_conf_file, err)
@@ -531,6 +538,7 @@ def in_process_setup(the_object_server=object_server):
storage_policy.reload_storage_policies()
global config
+ config['__file__'] = 'in_process_setup()'
if constraints.SWIFT_CONSTRAINTS_LOADED:
# Use the swift constraints that are loaded for the test framework
# configuration