When a SpecialAgentTask is passed an existing SpecialTask, set the _working_directory upon object construction. It was previously set in prolog(), but recovery agents don't run prolog, but they still need _working_directory sometimes (i.e. when a RepairTask fails).
Signed-off-by: Steve Howard <showard@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3419 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/scheduler/monitor_db_unittest.py b/scheduler/monitor_db_unittest.py
index f0b6e4d..352e4ad 100644
--- a/scheduler/monitor_db_unittest.py
+++ b/scheduler/monitor_db_unittest.py
@@ -1444,6 +1444,19 @@
queue_entry=self.queue_entry)
+ def test_recovery_repair_task_working_directory(self):
+ # ensure that a RepairTask recovering an existing SpecialTask picks up
+ # the working directory immediately
+ class MockSpecialTask(object):
+ def execution_path(self):
+ return '/my/path'
+
+ special_task = MockSpecialTask()
+ task = monitor_db.RepairTask(self.host, task=special_task)
+
+ self.assertEquals(task._working_directory, '/my/path')
+
+
def test_repair_task_aborted(self):
self.host.set_status.expect_call('Repairing')
self.setup_run_monitor(0, '1-repair', aborted=True)