Exemplo n.º 1
0
    def add_mcrouter(self,
                     config,
                     route=None,
                     extra_args=None,
                     replace_map=None,
                     bg_mcrouter=False,
                     replace_ports=True,
                     flavor=None):
        self.ensureClassVariables()
        substitute_ports = None
        if replace_ports:
            substitute_ports = (self.open_ports if 'port_map'
                                not in self.__dict__ else self.port_map)

        mcrouter = Mcrouter(config,
                            substitute_config_ports=substitute_ports,
                            default_route=route,
                            extra_args=extra_args,
                            replace_map=replace_map,
                            flavor=flavor)
        mcrouter.ensure_connected()

        if bg_mcrouter:
            self.open_ports.append(mcrouter.getport())

        if 'open_mcrouters' not in self.__dict__:
            self.open_mcrouters = []
        self.open_mcrouters.append(mcrouter)
        return mcrouter
Exemplo n.º 2
0
    def test_double_bind(self):
        mcr1 = self.get_mcrouter()
        time.sleep(1)
        mcr2 = Mcrouter(self.null_route_config, port=mcr1.port)

        time.sleep(4)
        self.assertTrue(mcr1.is_alive())
        self.assertFalse(mcr2.is_alive())
Exemplo n.º 3
0
    def test_double_bind(self):
        mcr1 = self.get_mcrouter()
        time.sleep(1)
        mcr2 = Mcrouter(self.null_route_config, port=mcr1.port)

        time.sleep(2)
        self.assertTrue(mcr1.is_alive())
        self.assertFalse(mcr2.is_alive())
Exemplo n.º 4
0
 def test_double_bind(self):
     mcr1 = self.get_mcrouter()
     mcr2 = Mcrouter(self.null_route_config, port=mcr1.port)
     self.assertTrue(mcr1.is_alive())
     retries = 20
     while mcr2.is_alive() and retries > 0:
         retries = retries - 1
         time.sleep(1)
     self.assertFalse(mcr2.is_alive())
Exemplo n.º 5
0
    def add_mcrouter(self, config, route=None, extra_args=[], replace_map=None):
        self.ensureClassVariables()
        substitute_ports = (self.open_ports
                            if 'port_map' not in self.__dict__
                            else self.port_map)

        mcrouter = Mcrouter(config,
                            substitute_config_ports=substitute_ports,
                            default_route=route,
                            extra_args=extra_args,
                            replace_map=replace_map)
        mcrouter.ensure_connected()
        if 'open_mcrouters' not in self.__dict__:
            self.open_mcrouters = []
        self.open_mcrouters.append(mcrouter)
        return mcrouter
    def setUp(self):
        self.mc = []
        # configure SleepServer for the east and wc pools
        for _i in range(5):
            self.mc.append(Mcrouter(self.null_route_config,
                           extra_args=self.mcrouter_server_extra_args))
            self.add_server(self.mc[_i])

        for _i in range(12):
            self.mc.append(Mcrouter(self.null_route_config,
                           extra_args=self.mcrouter_server_extra_args))
            self.add_server(self.mc[5 + _i])

        self.mcrouter = self.add_mcrouter(
            self.config,
            extra_args=self.extra_args)
 def makeServers(self):
     ret = []
     for _ in range(8):
         ret.append(
             Mcrouter(
                 "./mcrouter/test/test_nullroute.json",
                 extra_args=["--server-load-interval-ms=50"],
             ))
     return ret
    def setUp(self):
        self.mc = []
        for _i in range(5):
            self.mc.append(
                Mcrouter(self.null_route_config,
                         extra_args=self.mcrouter_server_extra_args))
            self.add_server(self.mc[_i])

        self.mcrouter = self.add_mcrouter(self.config,
                                          extra_args=self.extra_args)
Exemplo n.º 9
0
 def get_mcrouter(self):
     return self.add_server(
         Mcrouter(self.config, extra_args=self.extra_args))