mirror of
https://github.com/ceph/ceph
synced 2025-03-30 07:19:14 +00:00
s3readwrite.py: enable overrides
Enable s3readwrite task to have the branch to download specified and for overrides to be incorporated into the config at run-time. Code based on the s3tests.py task. Signed-off-by: Joe Buck <jbbuck@gmail.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
parent
18580c1d9c
commit
70f4eeb970
@ -17,27 +17,42 @@ log = logging.getLogger(__name__)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def download(ctx, config):
|
||||
assert isinstance(config, list)
|
||||
assert isinstance(config, dict)
|
||||
log.info('Downloading s3-tests...')
|
||||
for client in config:
|
||||
testdir = teuthology.get_testdir(ctx)
|
||||
for (client, cconf) in config.items():
|
||||
branch = cconf.get('force-branch', None)
|
||||
if not branch:
|
||||
branch = cconf.get('branch', 'master')
|
||||
sha1 = cconf.get('sha1')
|
||||
ctx.cluster.only(client).run(
|
||||
args=[
|
||||
'git', 'clone',
|
||||
'-b', branch,
|
||||
# 'https://github.com/ceph/s3-tests.git',
|
||||
'git://ceph.com/git/s3-tests.git',
|
||||
'{tdir}/s3-tests'.format(tdir=teuthology.get_testdir(ctx)),
|
||||
'{tdir}/s3-tests'.format(tdir=testdir),
|
||||
],
|
||||
)
|
||||
if sha1 is not None:
|
||||
ctx.cluster.only(client).run(
|
||||
args=[
|
||||
'cd', '{tdir}/s3-tests'.format(tdir=testdir),
|
||||
run.Raw('&&'),
|
||||
'git', 'reset', '--hard', sha1,
|
||||
],
|
||||
)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
log.info('Removing s3-tests...')
|
||||
testdir = teuthology.get_testdir(ctx)
|
||||
for client in config:
|
||||
ctx.cluster.only(client).run(
|
||||
args=[
|
||||
'rm',
|
||||
'-rf',
|
||||
'{tdir}/s3-tests'.format(tdir=teuthology.get_testdir(ctx)),
|
||||
'{tdir}/s3-tests'.format(tdir=testdir),
|
||||
],
|
||||
)
|
||||
|
||||
@ -241,6 +256,15 @@ def task(ctx, config):
|
||||
config = dict.fromkeys(config)
|
||||
clients = config.keys()
|
||||
|
||||
overrides = ctx.config.get('overrides', {})
|
||||
# merge each client section, not the top level.
|
||||
for client in config.iterkeys():
|
||||
if not config[client]:
|
||||
config[client] = {}
|
||||
teuthology.deep_merge(config[client], overrides.get('s3readwrite', {}))
|
||||
|
||||
log.debug('in s3readwrite, config is %s', config)
|
||||
|
||||
s3tests_conf = {}
|
||||
for client in clients:
|
||||
if config[client] is None:
|
||||
@ -259,7 +283,7 @@ def task(ctx, config):
|
||||
})
|
||||
|
||||
with contextutil.nested(
|
||||
lambda: download(ctx=ctx, config=clients),
|
||||
lambda: download(ctx=ctx, config=config),
|
||||
lambda: create_users(ctx=ctx, config=dict(
|
||||
clients=clients,
|
||||
s3tests_conf=s3tests_conf,
|
||||
|
Loading…
Reference in New Issue
Block a user