tests: fix various object leaks cont
Do not use self.fail when handling exception - this will keep exception object referenced, which in turn have reference to domain object (via traceback).
This commit is contained in:
parent
f9da1f2dd7
commit
9172a7708d
@ -481,14 +481,16 @@ class VmNetworkingMixin(object):
|
|||||||
self.loop.run_until_complete(self.proxy.run_for_stdio(
|
self.loop.run_until_complete(self.proxy.run_for_stdio(
|
||||||
cmd, user='root'))
|
cmd, user='root'))
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
self.fail('{} failed with: {}'.format(cmd, e.returncode))
|
raise AssertionError(
|
||||||
|
'{} failed with: {}'.format(cmd, e.returncode)) from None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = 'iptables -I INPUT -s {} -j ACCEPT'.format(self.testvm2.ip)
|
cmd = 'iptables -I INPUT -s {} -j ACCEPT'.format(self.testvm2.ip)
|
||||||
self.loop.run_until_complete(self.proxy.run_for_stdio(
|
self.loop.run_until_complete(self.proxy.run_for_stdio(
|
||||||
cmd, user='root'))
|
cmd, user='root'))
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
self.fail('{} failed with: {}'.format(cmd, e.returncode))
|
raise AssertionError(
|
||||||
|
'{} failed with: {}'.format(cmd, e.returncode)) from None
|
||||||
|
|
||||||
self.assertEqual(self.run_cmd(self.testvm2,
|
self.assertEqual(self.run_cmd(self.testvm2,
|
||||||
self.ping_cmd.format(target=self.testvm1.ip)), 0)
|
self.ping_cmd.format(target=self.testvm1.ip)), 0)
|
||||||
@ -498,8 +500,8 @@ class VmNetworkingMixin(object):
|
|||||||
(stdout, _) = self.loop.run_until_complete(
|
(stdout, _) = self.loop.run_until_complete(
|
||||||
self.testvm1.run_for_stdio(cmd, user='root'))
|
self.testvm1.run_for_stdio(cmd, user='root'))
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
self.fail(
|
raise AssertionError(
|
||||||
'{} failed with {}'.format(cmd, e.returncode))
|
'{} failed with {}'.format(cmd, e.returncode)) from None
|
||||||
self.assertNotEqual(stdout.decode().split()[0], '0',
|
self.assertNotEqual(stdout.decode().split()[0], '0',
|
||||||
'Packets didn\'t managed to the VM')
|
'Packets didn\'t managed to the VM')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user