Fix monitor_db_unittest, broken by previous change to refactor cleanup code. Two main things here:
* 24hr cleanup was running upon object construction, which meant it was running inadvertently during unit testing. Fixed this with the usual trick of moving that action from the constructor to an initialize() function, which gets called separately in monitor_db and which the unit test avoids.
* one of the scheduler unit tests was actually testing cleanup code; change that to call the newly located function. this test should maybe be moved to a separate unit test file for the monitor_db_cleanup module, but I just want to get things working again for now.
Signed-off-by: Steve Howard <showard@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3029 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/scheduler/monitor_db_cleanup.py b/scheduler/monitor_db_cleanup.py
index 4e64a78..9a55da6 100644
--- a/scheduler/monitor_db_cleanup.py
+++ b/scheduler/monitor_db_cleanup.py
@@ -17,7 +17,11 @@
self._db = db
self.clean_interval = clean_interval
self._last_clean_time = time.time()
- if run_at_initialize:
+ self._run_at_initialize = run_at_initialize
+
+
+ def initialize(self):
+ if self._run_at_initialize:
self._cleanup()