def test_build_times_capturing_error(self): def cb(*args, **kwargs): raise TypeError self.setupFakeStorage([capture.CaptureBuildStartTime('builder1', cb)]) self.setupBuild() self.master.db.builds.setBuildProperty(1, 'test_name', 'test_value', 'test_source') self.master.db.builds.finishBuild(buildid=1, results=0) build = yield self.master.db.builds.getBuild(buildid=1) cap = self.fake_storage_service.captures[0] yield self.assertFailure( cap.consume(self.routingKey, self.get_dict(build)), CaptureCallbackError) self.setupFakeStorage([capture.CaptureBuildEndTime('builder1', cb)]) cap = self.fake_storage_service.captures[0] yield self.assertFailure( cap.consume(self.routingKey, self.get_dict(build)), CaptureCallbackError) self.setupFakeStorage( [capture.CaptureBuildDuration('builder1', callback=cb)]) cap = self.fake_storage_service.captures[0] yield self.assertFailure( cap.consume(self.routingKey, self.get_dict(build)), CaptureCallbackError)
def build_time_capture_helper(self, time_type, cb=None): self.setupFakeStorage([ capture.CaptureBuildDuration('builder1', report_in=time_type, callback=cb) ]) self.setupBuild() yield self.end_build_call_consumers()
def test_build_duration_report_in_error(self): self.assertRaises( config.ConfigErrors, lambda: capture.CaptureBuildDuration('builder1', report_in='foobar'))