]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
s3tests, s3readwrite, swift: cleanup explicitly
authorYehuda Sadeh <yehuda@inktank.com>
Mon, 29 Apr 2013 18:24:04 +0000 (11:24 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 29 Apr 2013 18:24:04 +0000 (11:24 -0700)
Cleaning up test dir explicitly after run, so that
consecutive runs don't fail.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
teuthology/task/s3readwrite.py
teuthology/task/s3tests.py
teuthology/task/swift.py

index 87992f22c933cd5b82d9b9c281a4579a5763cf11..fec46e9b6a94710b263413774101a5971164cc92 100644 (file)
@@ -31,15 +31,7 @@ def download(ctx, config):
     try:
         yield
     finally:
-        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)),
-                    ],
-                )
+        cleanup_tests(ctx, config)
 
 def _config_user(s3tests_conf, section, user):
     s3tests_conf[section].setdefault('user_id', user)
@@ -149,6 +141,18 @@ 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)),
+                ],
+            )
+
 @contextlib.contextmanager
 def task(ctx, config):
     """
@@ -250,5 +254,6 @@ def task(ctx, config):
                 s3tests_conf=s3tests_conf,
                 )),
         lambda: run_tests(ctx=ctx, config=config),
+        lambda: cleanup_tests(ctx=ctx, config=config),
         ):
         yield
index a52ccc723cb0c5eb61050a88b8abfa24b7e6579d..00dc210cfd0faa1572d471c59bd1bb70cec543fe 100644 (file)
@@ -42,15 +42,7 @@ def do_download(ctx, config):
     try:
         yield
     finally:
-        log.info('Removing s3-tests...')
-        for client in config:
-            ctx.cluster.only(client).run(
-                args=[
-                    'rm',
-                    '-rf',
-                    '{tdir}/s3-tests'.format(tdir=testdir),
-                    ],
-                )
+        cleanup_tests(ctx, config)
 
 @contextlib.contextmanager
 def download(ctx, config):
@@ -157,6 +149,20 @@ 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):
     """
@@ -241,5 +247,6 @@ def task(ctx, config):
                 s3tests_conf=s3tests_conf,
                 )),
         lambda: run_tests(ctx=ctx, config=config),
+        lambda: cleanup_tests(ctx=ctx, config=config),
         ):
         yield
index 076509b2dd08f2854ecfa08261b3c8825835faf4..f832ca79c1e5e1c026b69c6468d219b81f118eb5 100644 (file)
@@ -29,15 +29,7 @@ def download(ctx, config):
     try:
         yield
     finally:
-        log.info('Removing swift...')
-        for client in config:
-            ctx.cluster.only(client).run(
-                args=[
-                    'rm',
-                    '-rf',
-                    '{tdir}/swift'.format(tdir=testdir),
-                    ],
-                )
+        cleanup_tests(ctx, config)
 
 def _config_user(testswift_conf, account, user, suffix):
     testswift_conf['func_test'].setdefault('account{s}'.format(s=suffix), account);
@@ -134,6 +126,18 @@ def run_tests(ctx, config):
             )
     yield
 
+@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),
+                ],
+            )
 
 @contextlib.contextmanager
 def task(ctx, config):
@@ -212,5 +216,6 @@ def task(ctx, config):
                 testswift_conf=testswift_conf,
                 )),
         lambda: run_tests(ctx=ctx, config=config),
+        lambda: cleanup_tests(ctx=ctx, config=config),
         ):
         yield