Add test case for projects with one job.

This situation exposed a problem where tests for the second change
would not be run if the change in front of it had one job marked
hold and succeeded.

Change-Id: I8f3c3bdb9d3631efc8b207a61d5a9086808cafb4
Reviewed-on: https://review.openstack.org/11818
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index d9da0ee..47acc67 100644
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -581,6 +581,7 @@
         init_repo("org/project")
         init_repo("org/project1")
         init_repo("org/project2")
+        init_repo("org/one-job-project")
         self.config = CONFIG
         self.sched = zuul.scheduler.Scheduler()
 
@@ -1173,3 +1174,25 @@
         print '  repo messages  :', repo_messages
         correct_messages = ['initial commit', 'mp commit', 'B-1']
         assert repo_messages == correct_messages
+
+    def test_one_job_project(self):
+        "Test that queueing works with one job"
+        A = self.fake_gerrit.addFakeChange('org/one-job-project',
+                                           'master', 'A')
+        B = self.fake_gerrit.addFakeChange('org/one-job-project',
+                                           'master', 'B')
+        A.addApproval('CRVW', 2)
+        B.addApproval('CRVW', 2)
+        self.fake_gerrit.addEvent(A.addApproval('APRV', 1))
+        self.fake_gerrit.addEvent(B.addApproval('APRV', 1))
+        self.waitUntilSettled()
+
+        jobs = self.fake_jenkins.all_jobs
+        finished_jobs = self.fake_jenkins.job_history
+        print jobs
+        print finished_jobs
+
+        assert A.data['status'] == 'MERGED'
+        assert A.reported == 2
+        assert B.data['status'] == 'MERGED'
+        assert B.reported == 2