def test_exception_in_listener(self):
     def listener(e):
         raise RuntimeError("error")
     config = ClientConfig()
     config.lifecycle_listeners = [listener]
     self.cluster.start_member()
     self.create_client(config)
Пример #2
0
    def test_exception_in_listener(self):
        def listener(e):
            raise RuntimeError("error")

        config = ClientConfig()
        config.lifecycle_listeners = [listener]
        self.cluster.start_member()
        self.create_client(config)
    def test_lifecycle_listener(self):
        collector = event_collector()
        config = ClientConfig()
        config.lifecycle_listeners = [collector]
        self.cluster.start_member()
        client = self.create_client(config)
        client.shutdown()

        # noinspection PyUnresolvedReferences
        self.assertEqual(collector.events,
                         [LIFECYCLE_STATE_STARTING, LIFECYCLE_STATE_CONNECTED, LIFECYCLE_STATE_SHUTTING_DOWN,
                          LIFECYCLE_STATE_SHUTDOWN])
Пример #4
0
    def test_lifecycle_listener(self):
        collector = event_collector()
        config = ClientConfig()
        config.lifecycle_listeners = [collector]
        self.cluster.start_member()
        client = self.create_client(config)
        client.shutdown()

        # noinspection PyUnresolvedReferences
        self.assertEqual(collector.events, [
            LIFECYCLE_STATE_STARTING, LIFECYCLE_STATE_CONNECTED,
            LIFECYCLE_STATE_SHUTTING_DOWN, LIFECYCLE_STATE_SHUTDOWN
        ])