Perform live reconfiguration

Change-Id: I69563ee47dd6f3777a52b67999ff1a03247f1e1e
Reviewed-on: https://review.openstack.org/35324
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
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 6f70c63..3d07c13 100644
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -2281,3 +2281,23 @@
         assert self.getJobFromHistory('node-project-merge').node is None
         assert self.getJobFromHistory('node-project-test1').node == 'debian'
         assert self.getJobFromHistory('node-project-test2').node is None
+
+    def test_live_reconfiguration(self):
+        "Test that live reconfiguration works"
+        self.worker.hold_jobs_in_build = True
+        A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
+        A.addApproval('CRVW', 2)
+        self.fake_gerrit.addEvent(A.addApproval('APRV', 1))
+        self.waitUntilSettled()
+
+        self.sched.reconfigure(self.config)
+
+        self.worker.hold_jobs_in_build = False
+        self.worker.release()
+        self.waitUntilSettled()
+        assert self.getJobFromHistory('project-merge').result == 'SUCCESS'
+        assert self.getJobFromHistory('project-test1').result == 'SUCCESS'
+        assert self.getJobFromHistory('project-test2').result == 'SUCCESS'
+        assert A.data['status'] == 'MERGED'
+        assert A.reported == 2
+        self.assertEmptyQueues()