]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
rgw tests: clean up immediately after the test
authorJosh Durgin <josh.durgin@inktank.com>
Tue, 30 Apr 2013 23:47:34 +0000 (16:47 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Tue, 30 Apr 2013 23:47:34 +0000 (16:47 -0700)
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 <josh.durgin@inktank.com>
teuthology/task/s3readwrite.py
teuthology/task/s3roundtrip.py
teuthology/task/s3tests.py
teuthology/task/swift.py

index aa9c41902f4d8ad5a0ac27c161b816823b722aef..f44c343f7c0b0c1b34298a772b59ffc1535344f8 100644 (file)
@@ -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
index 9d375bbab9425cbfdd47b647b2693d0b41b2fe3c..64995498d3139c113ac82286beb2f304be52a8b0 100644 (file)
@@ -253,4 +253,5 @@ def task(ctx, config):
                 )),
         lambda: run_tests(ctx=ctx, config=config),
         ):
-        yield
+        pass
+    yield
index 00dc210cfd0faa1572d471c59bd1bb70cec543fe..3bae160481bece4ff1e410231977133597fecdff 100644 (file)
@@ -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
index 7692a5d03c45cb04e99c639bfd1c86305d203893..a799f62470d4f8d07004c1a778d42aa700e8f5ac 100644 (file)
@@ -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