Example #1
0
 def test_stop_with_grouping_enabled(self):
     service = coordination.Coordination(
         self.name, self.tg, grouping_enabled=True
     )
     service.start()
     service.stop()
     self.assertFalse(service.started)
    def test_start(self):
        service = coordination.Coordination(self.name, self.tg)
        service.start()

        self.assertTrue(service.started)
        self.assertIn(self.name.encode('utf-8'),
                      service.coordinator.get_groups().get())
        self.assertIn(
            service.coordination_id.encode('utf-8'),
            service.coordinator.get_members(self.name.encode('utf-8')).get())
        service.stop()
Example #3
0
    def __init__(self):
        self._partitioner = None

        self._storage = None
        self._quota = None

        super(Service, self).__init__(
            self.service_name,
            cfg.CONF['service:producer'].topic,
            threads=cfg.CONF['service:producer'].threads,
        )

        self.coordination = coordination.Coordination(self.service_name,
                                                      self.tg)
Example #4
0
 def test_stop_no_coordination(self):
     self.config(backend_url=None, group="coordination")
     service = coordination.Coordination(self.name, self.tg)
     self.assertIsNone(service.coordinator)
     service.start()
     service.stop()
Example #5
0
 def test_stop(self):
     service = coordination.Coordination(self.name, self.tg)
     service.start()
     service.stop()
     self.assertFalse(service.started)
Example #6
0
 def __init__(self):
     super(CoordinatedService, self).__init__()
     self.coordination = coordination.Coordination(
         self.service_name, self.tg
     )