mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-13 09:48:10 +03:00
Improve cleanup lifecycle readability
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -161,8 +161,10 @@ class SingTUNLinuxHostTest(unittest.TestCase):
|
||||
def wait(timeout=None):
|
||||
self.assertIsNone(timeout)
|
||||
entered.set()
|
||||
|
||||
if not authorized.wait(5):
|
||||
raise RuntimeError('fixture authorization was not released')
|
||||
|
||||
process.poll.return_value = 0
|
||||
return 0
|
||||
|
||||
@@ -173,6 +175,7 @@ class SingTUNLinuxHostTest(unittest.TestCase):
|
||||
self.host.execute([['ip', 'link', 'delete', 'dev', 'utun101']])
|
||||
except Exception as ex:
|
||||
# Any non-exit exceptions
|
||||
|
||||
errors.append(ex)
|
||||
finally:
|
||||
complete.set()
|
||||
@@ -182,6 +185,7 @@ class SingTUNLinuxHostTest(unittest.TestCase):
|
||||
), mock.patch.object(self.module.subprocess, 'Popen', return_value=process):
|
||||
worker = threading.Thread(target=recover)
|
||||
worker.start()
|
||||
|
||||
try:
|
||||
self.assertTrue(entered.wait(2))
|
||||
self.assertFalse(complete.is_set())
|
||||
@@ -269,8 +273,10 @@ class SingTUNLinuxHostTest(unittest.TestCase):
|
||||
|
||||
self.assertIs(self.host._process, process)
|
||||
self.assertTrue(directory.exists())
|
||||
|
||||
process.poll.return_value = 126
|
||||
self.host.drain()
|
||||
|
||||
self.assertFalse(directory.exists())
|
||||
|
||||
def testLiveForwarderDnsCannotBeReportedAsRestored(self):
|
||||
|
||||
Reference in New Issue
Block a user