| Index: infra_libs/ts_mon/common/interface.py
|
| diff --git a/infra_libs/ts_mon/common/interface.py b/infra_libs/ts_mon/common/interface.py
|
| index 40581a5ab12d03d2259fbf38904f622d6e1a1123..73d6de2024e4d60930e77af1b7a6d5fd1a4a5276 100644
|
| --- a/infra_libs/ts_mon/common/interface.py
|
| +++ b/infra_libs/ts_mon/common/interface.py
|
| @@ -78,6 +78,11 @@ class State(object):
|
| # Cached time of the last flush. Useful mostly in AppEngine apps.
|
| self.last_flushed = datetime.datetime.utcfromtimestamp(0)
|
|
|
| + def reset_for_unittest(self):
|
| + self.metrics = {}
|
| + self.last_flushed = datetime.datetime.utcfromtimestamp(0)
|
| + self.store.reset_for_unittest()
|
| +
|
| state = State()
|
|
|
|
|
| @@ -132,8 +137,10 @@ def close():
|
| state.flush_thread.stop()
|
|
|
|
|
| -def reset_for_unittest():
|
| - state.store.reset_for_unittest()
|
| +def reset_for_unittest(disable=False):
|
| + state.reset_for_unittest()
|
| + if disable:
|
| + state.flush_enabled_fn = lambda: False
|
|
|
|
|
| class _FlushThread(threading.Thread):
|
|
|