mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-21 23:29:47 +00:00
Add support for default_region
Changes to actually use the 'default_region' setting in the S3TEST_CONF file. Previously, the first connection set was assumed to be the default. This means that the parse order of the S3TEST_CONF file was dictating how the tests behaved, resulting in failures in some cases. Signed-off-by: Joe Buck <jbbuck@gmail.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
parent
b4b99d3e23
commit
703e66d547
1 changed files with 21 additions and 1 deletions
|
@ -182,6 +182,9 @@ class RegionsConn:
|
|||
def iteritems(self):
|
||||
return self.m.iteritems()
|
||||
|
||||
def set_default(self, conn):
|
||||
self.default = conn
|
||||
|
||||
def add(self, name, conn):
|
||||
self.m[name] = conn
|
||||
if not self.default:
|
||||
|
@ -217,6 +220,12 @@ def setup():
|
|||
template = 'test-{random}-'
|
||||
prefix = choose_bucket_prefix(template=template)
|
||||
|
||||
# pull the default_region out, if it exists
|
||||
try:
|
||||
default_region = cfg.get('fixtures', 'default_region')
|
||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
|
||||
default_region = None
|
||||
|
||||
s3.clear()
|
||||
config.clear()
|
||||
|
||||
|
@ -263,7 +272,18 @@ def setup():
|
|||
# TODO test vhost calling format
|
||||
calling_format=conf.calling_format,
|
||||
)
|
||||
targets[name].add(k, TargetConnection(conf, conn))
|
||||
|
||||
temp_targetConn = TargetConnection(conf, conn)
|
||||
targets[name].add(k, temp_targetConn)
|
||||
|
||||
# Explicitly test for and set the default region, if specified.
|
||||
# If it was not specified, use the 'is_master' flag to set it.
|
||||
if default_region:
|
||||
if default_region == name:
|
||||
targets[name].set_default(temp_targetConn)
|
||||
elif conf.is_master:
|
||||
targets[name].set_default(temp_targetConn)
|
||||
|
||||
s3[name] = targets[name].default.connection
|
||||
|
||||
# WARNING! we actively delete all buckets we see with the prefix
|
||||
|
|
Loading…
Reference in a new issue