Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def test_build_end_time_capturing(self):
        self.setupFakeStorage([capture.CaptureBuildEndTime('builder1')])
        self.setupBuild()
        yield self.end_build_call_consumers()

        self.assertEqual('end-time',
                         self.fake_storage_service.stored_data[0][0].keys()[0])
Exemplo n.º 3
0
    def test_build_end_time_capturing_alt_callback(self):
        def cb(*args, **kwargs):
            return '2015-07-08T01:45:17.391018'
        self.setupFakeStorage([capture.CaptureBuildEndTime('builder1', cb)])
        self.setupBuild()
        yield self.end_build_call_consumers()

        self.assertEqual('end-time', self.fake_storage_service.stored_data[0][0].keys()[0])