Detect multi-region test cases

Enable multi-region calls and tests only if
the configuration has specified a
radosgw-agent tastk.

Signed-off-by: Joe Buck <jbbuck@gmail.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
Joe Buck 2013-08-15 12:51:51 -07:00
parent 4a47eedce7
commit 2c9ac3e0ee
2 changed files with 13 additions and 5 deletions

View File

@ -28,6 +28,12 @@ def successful_ops(out):
entry = summary[0]
return entry['total']['successful_ops']
# simple test to indicate if multi-region testing should occur
def multi_region_enabled(ctx):
# this is populated by the radosgw_agent task, seems reasonable to use that as an indicator that
# we're testing multi-region sync
return 'radosgw_agent' in ctx
def task(ctx, config):
"""
Test radosgw-admin functionality against a running rgw instance.
@ -43,11 +49,11 @@ def task(ctx, config):
config = dict.fromkeys(config)
clients = config.keys()
client = rgw_utils.get_master_client(ctx, clients)
multi_region_run = multi_region_enabled(ctx)
if not client:
# oh, well, just use the first client... multiregion stuff might not work correctly
client = clients[0];
client = clients[0]; # default choice, multi-region code may overwrite this
if multi_region_run:
client = rgw_utils.get_master_client(ctx, clients)
##
user1='foo'
@ -220,7 +226,8 @@ def task(ctx, config):
assert not err
assert len(out) == 0
rgw_utils.radosgw_agent_sync_all(ctx)
if multi_region_run:
rgw_utils.radosgw_agent_sync_all(ctx)
# connect to rgw
(remote,) = ctx.cluster.only(client).remotes.iterkeys()

View File

@ -167,6 +167,7 @@ def task(ctx, config):
teuthology.deep_merge(config[client], overrides.get('radosgw-agent', {}))
ctx.radosgw_agent = argparse.Namespace()
ctx.radosgw_agent.config = config
procs = run_radosgw_agent(ctx, config)