Fix config test interaction with report_times.

In a config test, the scheduler is created without a config object.
Handle that case gracefully in the pipeline constructor.

Add a test that runs the configtest.

Change-Id: Id59b3194aff7b5347fa04fe1cc29b1069d2a3f7f
Reviewed-on: https://review.openstack.org/27585
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
James E. Blair 2013-04-26 11:17:03 -07:00 committed by Jenkins
parent 0ac6c01692
commit 3c5e5b507f
2 changed files with 8 additions and 1 deletions

View File

@ -2071,3 +2071,8 @@ class testScheduler(unittest.TestCase):
assert B.data['status'] == 'MERGED'
assert B.reported == 2
self.assertEmptyQueues()
def test_test_config(self):
"Test that we can test the config"
sched = zuul.scheduler.Scheduler()
sched.testConfig(CONFIG.get('zuul', 'layout_config'))

View File

@ -45,6 +45,7 @@ class Scheduler(threading.Thread):
self._stopped = False
self.launcher = None
self.trigger = None
self.config = None
self.trigger_event_queue = Queue.Queue()
self.result_event_queue = Queue.Queue()
@ -508,7 +509,8 @@ class BasePipelineManager(object):
self.success_action = {}
self.failure_action = {}
self.start_action = {}
if self.sched.config.has_option('zuul', 'report_times'):
if self.sched.config and self.sched.config.has_option(
'zuul', 'report_times'):
self.report_times = self.sched.config.getboolean(
'zuul', 'report_times')
else: