diff --git a/test/probe/common.py b/test/probe/common.py index eb2ba2e7a6..ccb5751f26 100644 --- a/test/probe/common.py +++ b/test/probe/common.py @@ -266,18 +266,26 @@ def get_policy(**kwargs): raise unittest.SkipTest('No policy matching %s' % kwargs) -def resetswift(): - p = Popen("resetswift 2>&1", shell=True, stdout=PIPE) +def run_cleanup(cmd): + p = Popen(cmd + " 2>&1", shell=True, stdout=PIPE) stdout, _stderr = p.communicate() if p.returncode: raise AssertionError( - 'Cleanup with "resetswift" failed: stdout: %s, stderr: %s' - % (stdout, _stderr)) + 'Cleanup with %r failed: stdout: %s, stderr: %s' + % (cmd, stdout, _stderr)) print(stdout) Manager(['all']).stop() +def resetswift(): + run_cleanup("resetswift") + + +def kill_orphans(): + run_cleanup("swift-orphans -a 0 -k 9") + + class Body(object): def __init__(self, total=3.5 * 2 ** 20): @@ -328,6 +336,7 @@ class ProbeTest(unittest.TestCase): def setUp(self): resetswift() + kill_orphans() try: self.ipport2server = {} self.configs = defaultdict(dict)