kill orphans during probe test setup
orphans processes sometimes cause probe test failures so get rid of them before each test. Change-Id: I4ba6748d30fbb28371f13aa95387c49bc8223402
This commit is contained in:
parent
6b9098eead
commit
1f4ebbc990
@ -266,18 +266,26 @@ def get_policy(**kwargs):
|
|||||||
raise unittest.SkipTest('No policy matching %s' % kwargs)
|
raise unittest.SkipTest('No policy matching %s' % kwargs)
|
||||||
|
|
||||||
|
|
||||||
def resetswift():
|
def run_cleanup(cmd):
|
||||||
p = Popen("resetswift 2>&1", shell=True, stdout=PIPE)
|
p = Popen(cmd + " 2>&1", shell=True, stdout=PIPE)
|
||||||
stdout, _stderr = p.communicate()
|
stdout, _stderr = p.communicate()
|
||||||
if p.returncode:
|
if p.returncode:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Cleanup with "resetswift" failed: stdout: %s, stderr: %s'
|
'Cleanup with %r failed: stdout: %s, stderr: %s'
|
||||||
% (stdout, _stderr))
|
% (cmd, stdout, _stderr))
|
||||||
|
|
||||||
print(stdout)
|
print(stdout)
|
||||||
Manager(['all']).stop()
|
Manager(['all']).stop()
|
||||||
|
|
||||||
|
|
||||||
|
def resetswift():
|
||||||
|
run_cleanup("resetswift")
|
||||||
|
|
||||||
|
|
||||||
|
def kill_orphans():
|
||||||
|
run_cleanup("swift-orphans -a 0 -k 9")
|
||||||
|
|
||||||
|
|
||||||
class Body(object):
|
class Body(object):
|
||||||
|
|
||||||
def __init__(self, total=3.5 * 2 ** 20):
|
def __init__(self, total=3.5 * 2 ** 20):
|
||||||
@ -328,6 +336,7 @@ class ProbeTest(unittest.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
resetswift()
|
resetswift()
|
||||||
|
kill_orphans()
|
||||||
try:
|
try:
|
||||||
self.ipport2server = {}
|
self.ipport2server = {}
|
||||||
self.configs = defaultdict(dict)
|
self.configs = defaultdict(dict)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user