From 2c9ac3e0ee12a4b4eb100e65822f2be54452d576 Mon Sep 17 00:00:00 2001 From: Joe Buck Date: Thu, 15 Aug 2013 12:51:51 -0700 Subject: [PATCH] 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 Reviewed-by: Josh Durgin --- teuthology/task/radosgw-admin.py | 17 ++++++++++++----- teuthology/task/radosgw-agent.py | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/teuthology/task/radosgw-admin.py b/teuthology/task/radosgw-admin.py index 090c4fec39..0a385c8f81 100644 --- a/teuthology/task/radosgw-admin.py +++ b/teuthology/task/radosgw-admin.py @@ -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() diff --git a/teuthology/task/radosgw-agent.py b/teuthology/task/radosgw-agent.py index 7e5ca1c14c..19105ad487 100644 --- a/teuthology/task/radosgw-agent.py +++ b/teuthology/task/radosgw-agent.py @@ -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) -- 2.39.5