mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 18:08:53 +00:00
parent
381e86a931
commit
9ee90f4f2d
@ -437,9 +437,10 @@ def flaky(gen):
|
|||||||
worked = gen(this)
|
worked = gen(this)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
import traceback
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
exc_type, exc_obj, tb = sys.exc_info()
|
||||||
exceptions.append((e, fname, exc_tb.tb_lineno))
|
exceptions.append((e))
|
||||||
|
print (traceback.format_tb(tb)[1])
|
||||||
return False
|
return False
|
||||||
def wrapper(this):
|
def wrapper(this):
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
@ -447,12 +448,12 @@ def flaky(gen):
|
|||||||
return True
|
return True
|
||||||
i = 1
|
i = 1
|
||||||
for exc in exceptions:
|
for exc in exceptions:
|
||||||
print("Test (attempt %d) %s::%s failed: %s (%s:%d)" % (
|
print("Test (attempt %d) %s::%s failed: %s" % (
|
||||||
i,
|
i,
|
||||||
this.__class__.__name__,
|
this.__class__.__name__,
|
||||||
gen.__name__, str(exc[0]), exc[1], exc[2]))
|
gen.__name__, str(exc[0])))
|
||||||
i += 1
|
i += 1
|
||||||
raise exceptions[0][0]
|
raise Exception(exceptions[0][0])
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,13 +90,16 @@ class DaemonTests(test_base.ProcessGenerator, unittest.TestCase):
|
|||||||
# An interrupt signal will cause the daemon to stop.
|
# An interrupt signal will cause the daemon to stop.
|
||||||
daemon = self._run_daemon({
|
daemon = self._run_daemon({
|
||||||
"disable_watchdog": True,
|
"disable_watchdog": True,
|
||||||
|
"ephemeral": True,
|
||||||
|
"disable_database": True,
|
||||||
|
"disable_logging": True,
|
||||||
})
|
})
|
||||||
self.assertTrue(daemon.isAlive())
|
self.assertTrue(daemon.isAlive())
|
||||||
|
|
||||||
# Send a SIGINT
|
# Send a SIGINT
|
||||||
os.kill(daemon.pid, signal.SIGINT)
|
os.kill(daemon.pid, signal.SIGINT)
|
||||||
self.assertTrue(daemon.isDead(daemon.pid, 10))
|
self.assertTrue(daemon.isDead(daemon.pid, 10))
|
||||||
self.assertEqual(daemon.retcode, 128 + signal.SIGINT)
|
self.assertTrue(daemon.retcode in [128 + signal.SIGINT, -2])
|
||||||
|
|
||||||
@test_base.flaky
|
@test_base.flaky
|
||||||
def test_6_logger_mode(self):
|
def test_6_logger_mode(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user