* add a couple simple test cases to the scheduler functional test for metahosts
* augment one of the logging lines in the scheduler
Signed-off-by: Steve Howard <showard@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4009 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/scheduler/monitor_db_functional_test.py b/scheduler/monitor_db_functional_test.py
index f31cdf2..3b60931 100644
--- a/scheduler/monitor_db_functional_test.py
+++ b/scheduler/monitor_db_functional_test.py
@@ -935,5 +935,34 @@
# rest of job proceeds normally
+ def test_simple_metahost_assignment(self):
+ job = self._create_job(metahosts=[1])
+ self._run_dispatcher()
+ entry = job.hostqueueentry_set.all()[0]
+ self.assertEquals(entry.host.hostname, 'host1')
+ self._check_statuses(entry, HqeStatus.VERIFYING, HostStatus.VERIFYING)
+ self.mock_drone_manager.finish_process(_PidfileType.VERIFY)
+ self._run_dispatcher()
+ self._check_statuses(entry, HqeStatus.RUNNING, HostStatus.RUNNING)
+ # rest of job proceeds normally
+
+
+ def test_metahost_fail_verify(self):
+ self.hosts[1].labels.add(self.labels[0]) # put label1 also on host2
+ job = self._create_job(metahosts=[1])
+ self._run_dispatcher() # assigned to host1
+ self.mock_drone_manager.finish_process(_PidfileType.VERIFY,
+ exit_status=256)
+ self._run_dispatcher() # host1 failed, gets reassigned to host2
+ entry = job.hostqueueentry_set.all()[0]
+ self.assertEquals(entry.host.hostname, 'host2')
+ self._check_statuses(entry, HqeStatus.VERIFYING, HostStatus.VERIFYING)
+ self._check_host_status(self.hosts[0], HostStatus.REPAIRING)
+
+ self.mock_drone_manager.finish_process(_PidfileType.VERIFY)
+ self._run_dispatcher()
+ self._check_statuses(entry, HqeStatus.RUNNING, HostStatus.RUNNING)
+
+
if __name__ == '__main__':
unittest.main()