From ef56a72b73bd408bb51d235b2274eef8766e0277 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 22 Sep 2011 13:23:05 -0700 Subject: [PATCH] task/watch_notify_stress.py: add simple watch_notify stress test Signed-off-by: Samuel Just --- teuthology/task/watch_notify_stress.py | 80 ++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 teuthology/task/watch_notify_stress.py diff --git a/teuthology/task/watch_notify_stress.py b/teuthology/task/watch_notify_stress.py new file mode 100644 index 0000000000000..cd764041e8109 --- /dev/null +++ b/teuthology/task/watch_notify_stress.py @@ -0,0 +1,80 @@ +import contextlib +import logging + +from ..orchestra import run + +log = logging.getLogger(__name__) + +@contextlib.contextmanager +def task(ctx, config): + """ + Run test_stress_watch + + The config should be as follows: + + test_stress_watch: + clients: [client list] + + example: + + tasks: + - ceph: + - test_stress_watch: + clients: [client.0] + - interactive: + """ + log.info('Beginning test_stress_watch...') + assert isinstance(config, dict), \ + "please list clients to run on" + testsnaps = {} + + (mon,) = ctx.cluster.only('mon.0').remotes.iterkeys() + remotes = [] + for role in config.get('clients', ['client.0']): + assert isinstance(role, basestring) + PREFIX = 'client.' + assert role.startswith(PREFIX) + id_ = role[len(PREFIX):] + (remote,) = ctx.cluster.only(role).remotes.iterkeys() + remotes.append(remote) + + remote.run( + args=[ + 'cp', + '/tmp/cephtest/ceph.conf', + '/tmp/cephtest/data/ceph.conf', + ], + logger=log.getChild('test_stress_watch.{id}'.format(id=id_)), + wait=True, + ) + + proc = remote.run( + args=[ + '/bin/sh', '-c', + " ".join([ + 'cd', '/tmp/cephtest/data;', + 'export CEPH_CLIENT_ID={id_}; export CEPH_CONF=ceph.conf; LD_PRELOAD=/tmp/cephtest/binary/usr/local/lib/librados.so.2 /tmp/cephtest/binary/usr/local/bin/test_stress_watch'.format( + id_=id_), + ]) + ], + logger=log.getChild('testsnaps.{id}'.format(id=id_)), + stdin=run.PIPE, + wait=False + ) + testsnaps[id_] = proc + + try: + yield + finally: + for i in remotes: + i.run( + args=[ + 'rm', + '/tmp/cephtest/data/ceph.conf' + ], + logger=log.getChild('testsnaps.{id}'.format(id=id_)), + wait=True, + ) + + log.info('joining watch_notify_stress') + run.wait(testsnaps.itervalues()) -- 2.39.5