Added functional test for recovering jobs with atomic hosts, with HQEs
in Pending

Signed-off-by: James Ren <jamesren@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3896 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/scheduler/monitor_db_functional_test.py b/scheduler/monitor_db_functional_test.py
index eaa9e5b..da930d5 100644
--- a/scheduler/monitor_db_functional_test.py
+++ b/scheduler/monitor_db_functional_test.py
@@ -664,6 +664,19 @@
                                                 _PidfileType.VERIFY)
 
 
+    def test_recover_pending_hqes_with_group(self):
+        # recover a group of HQEs that are in Pending, in the same group (e.g.,
+        # in a job with atomic hosts)
+        job = self._create_job(hosts=[1,2], atomic_group=1)
+        job.save()
+
+        job.hostqueueentry_set.all().update(status=HqeStatus.PENDING)
+
+        self._initialize_test()
+        for queue_entry in job.hostqueueentry_set.all():
+            self.assertEquals(queue_entry.status, HqeStatus.STARTING)
+
+
     def test_job_scheduled_just_after_abort(self):
         # test a pretty obscure corner case where a job is aborted while queued,
         # another job is ready to run, and throttling is active. the post-abort