From: Josh Durgin Date: Tue, 30 Apr 2013 23:47:34 +0000 (-0700) Subject: rgw tests: clean up immediately after the test X-Git-Tag: 1.1.0~2167^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6aba6d2cadedd8fdcd8495ca639653ce15f6b2cc;p=teuthology.git rgw tests: clean up immediately after the test There's no need for an explicit cleanup function, so move it back to where it came from (except in s3roundtrip, which did not have it). Instead, since these use a nested contextmanager, pass through and yield to the top-level run_tasks after the nested contextmanager has finished (and thus run all the cleanup steps in the subtasks for this test). Signed-off-by: Josh Durgin --- diff --git a/teuthology/task/s3readwrite.py b/teuthology/task/s3readwrite.py index aa9c41902..f44c343f7 100644 --- a/teuthology/task/s3readwrite.py +++ b/teuthology/task/s3readwrite.py @@ -31,7 +31,16 @@ def download(ctx, config): try: yield finally: - cleanup_tests(ctx, config) + log.info('Removing s3-tests...') + for client in config: + ctx.cluster.only(client).run( + args=[ + 'rm', + '-rf', + '{tdir}/s3-tests'.format(tdir=teuthology.get_testdir(ctx)), + ], + ) + def _config_user(s3tests_conf, section, user): s3tests_conf[section].setdefault('user_id', user) @@ -141,19 +150,6 @@ def run_tests(ctx, config): yield -@contextlib.contextmanager -def cleanup_tests(ctx, config): - log.info('Removing s3-tests...') - for client in config: - ctx.cluster.only(client).run( - args=[ - 'rm', - '-rf', - '{tdir}/s3-tests'.format(tdir=teuthology.get_testdir(ctx)), - ], - ) - yield - @contextlib.contextmanager def task(ctx, config): """ @@ -255,6 +251,6 @@ def task(ctx, config): s3tests_conf=s3tests_conf, )), lambda: run_tests(ctx=ctx, config=config), - lambda: cleanup_tests(ctx=ctx, config=config), ): - yield + pass + yield diff --git a/teuthology/task/s3roundtrip.py b/teuthology/task/s3roundtrip.py index 9d375bbab..64995498d 100644 --- a/teuthology/task/s3roundtrip.py +++ b/teuthology/task/s3roundtrip.py @@ -253,4 +253,5 @@ def task(ctx, config): )), lambda: run_tests(ctx=ctx, config=config), ): - yield + pass + yield diff --git a/teuthology/task/s3tests.py b/teuthology/task/s3tests.py index 00dc210cf..3bae16048 100644 --- a/teuthology/task/s3tests.py +++ b/teuthology/task/s3tests.py @@ -42,7 +42,16 @@ def do_download(ctx, config): try: yield finally: - cleanup_tests(ctx, config) + 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=testdir), + ], + ) @contextlib.contextmanager def download(ctx, config): @@ -149,20 +158,6 @@ def run_tests(ctx, config): do_run_tests(ctx, config) yield -@contextlib.contextmanager -def cleanup_tests(ctx, config): - 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=testdir), - ], - ) - yield - @contextlib.contextmanager def task(ctx, config): """ @@ -247,6 +242,6 @@ def task(ctx, config): s3tests_conf=s3tests_conf, )), lambda: run_tests(ctx=ctx, config=config), - lambda: cleanup_tests(ctx=ctx, config=config), ): - yield + pass + yield diff --git a/teuthology/task/swift.py b/teuthology/task/swift.py index 7692a5d03..a799f6247 100644 --- a/teuthology/task/swift.py +++ b/teuthology/task/swift.py @@ -29,7 +29,16 @@ def download(ctx, config): try: yield finally: - cleanup_tests(ctx, config) + log.info('Removing swift...') + testdir = teuthology.get_testdir(ctx) + for client in config: + ctx.cluster.only(client).run( + args=[ + 'rm', + '-rf', + '{tdir}/swift'.format(tdir=testdir), + ], + ) def _config_user(testswift_conf, account, user, suffix): testswift_conf['func_test'].setdefault('account{s}'.format(s=suffix), account); @@ -128,17 +137,6 @@ def run_tests(ctx, config): @contextlib.contextmanager def cleanup_tests(ctx, config): - log.info('Removing swift...') - testdir = teuthology.get_testdir(ctx) - for client in config: - ctx.cluster.only(client).run( - args=[ - 'rm', - '-rf', - '{tdir}/swift'.format(tdir=testdir), - ], - ) - yield @contextlib.contextmanager def task(ctx, config): @@ -217,6 +215,6 @@ def task(ctx, config): testswift_conf=testswift_conf, )), lambda: run_tests(ctx=ctx, config=config), - lambda: cleanup_tests(ctx=ctx, config=config), ): - yield + pass + yield