Ejemplo n.º 1
0
    def test_parse_error(self):
        mcrouter = self.get_mcrouter(SleepServer(),
                                     ['--disable-miss-on-get-errors',
                                      '--server-timeout', '3000'])
        port = mcrouter.getport()
        addr = ('localhost', port)
        sock = self.connect(addr)
        fd = sock.makefile()
        # First send a normal request that will timeout followed by
        # mallformed request that will cause parsing error.
        sock.sendall(self.get_cmd + 'get\r\n')
        # Make sure the buffer is flushed.
        time.sleep(1)
        # Now send another normal request, it shouldn't be processed, since
        # server cannot parse further.
        sock.sendall(self.get_cmd)

        self.assertEquals('SERVER_ERROR timeout', fd.readline().strip())
        self.assertEquals('CLIENT_ERROR malformed request',
                          fd.readline().strip())

        # Check that mcrouter is still alive.
        self.assertTrue(mcrouter.is_alive())
        res = mcrouter.issue_command(self.get_cmd)
        self.assertEquals('SERVER_ERROR timeout\r\n', res)
Ejemplo n.º 2
0
 def test_tko_set(self):
     mcrouter = self.getMcrouter(SleepServer(),
                                 args=['--timeouts-until-tko', '1'])
     res = mcrouter.issue_command(self.set_cmd)
     res = mcrouter.issue_command(self.set_cmd)
     self.assertTrue(
         re.match('SERVER_ERROR Server unavailable. Reason: .*', res))
    def setUp(self):
        self.mc = []
        # configure SleepServer for all servers
        for _i in range(5):
            self.mc.append(SleepServer())
            self.add_server(self.mc[_i])

        self.mcrouter = self.add_mcrouter(self.config,
                                          extra_args=self.extra_args)
Ejemplo n.º 4
0
    def setUp(self):
        self.mc = []
        for _i in range(3):
            self.mc.append(
                Mcrouter(self.null_route_config,
                         extra_args=self.mcrouter_server_extra_args))
            self.add_server(self.mc[_i])

        # configure SleepServer for the east and wc pools
        for _i in range(3):
            self.mc.append(SleepServer())
            self.add_server(self.mc[_i + 3])

        self.mcrouter = self.add_mcrouter(self.config,
                                          extra_args=self.extra_args)
Ejemplo n.º 5
0
    def setUp(self):
        mc_ports = [
            11510, 11511, 11512, 11513,
            11520, 11521, 11522, 11523,
            11530, 11531, 11532, 11533,
            11541]
        mc_gut_port = 11540
        tmo_port = 11555

        # have to do these before starting mcrouter
        self.mcs = [self.add_server(Memcached(), logical_port=port)
                    for port in mc_ports]
        self.mc_gut = self.add_server(Memcached(), logical_port=mc_gut_port)
        self.mcs.append(self.mc_gut)

        self.add_server(SleepServer(), logical_port=tmo_port)

        for port in [65532, 65522]:
            self.add_server(DeadServer(), logical_port=port)

        self.mcrouter = self.add_mcrouter(self.config)
Ejemplo n.º 6
0
 def test_tko_delete(self):
     mcrouter = self.getMcrouter(SleepServer(),
                                 args=['--timeouts-until-tko', '1'])
     res = mcrouter.issue_command(self.set_cmd)
     res = mcrouter.issue_command(self.delete_cmd)
     self.assertEqual('NOT_FOUND\r\n', res)
Ejemplo n.º 7
0
 def test_tko_set(self):
     mcrouter = self.getMcrouter(SleepServer(),
                                 args=['--timeouts-until-tko', '1'])
     res = mcrouter.issue_command(self.set_cmd)
     res = mcrouter.issue_command(self.set_cmd)
     self.assertEqual('SERVER_ERROR unavailable\r\n', res)
Ejemplo n.º 8
0
 def test_timeout_delete(self):
     mcrouter = self.getMcrouter(SleepServer())
     res = mcrouter.issue_command(self.delete_cmd)
     self.assertEqual('NOT_FOUND\r\n', res)
Ejemplo n.º 9
0
 def test_timeout_get(self):
     mcrouter = self.getMcrouter(SleepServer())
     res = mcrouter.issue_command(self.get_cmd)
     self.assertEqual('END\r\n', res)
Ejemplo n.º 10
0
 def test_timeout_set(self):
     mcrouter = self.getMcrouter(SleepServer())
     res = mcrouter.issue_command(self.set_cmd)
     self.assertEqual('SERVER_ERROR timeout\r\n', res)
Ejemplo n.º 11
0
 def setUp(self):
     self.gutA = self.add_server(SleepServer())
     self.gutB = self.add_server(ConnectionErrorServer())
     self.gutC = self.add_server(Memcached())
Ejemplo n.º 12
0
 def setUp(self):
     self.gutA = self.add_server(SleepServer())
     self.gutB = self.add_server(SleepServer())
     self.gutC = self.add_server(Memcached())
Ejemplo n.º 13
0
 def setUp(self):
     # The order here must corresponds to the order of hosts in the .json
     self.mc = self.add_server(SleepServer())
Ejemplo n.º 14
0
 def setUp(self) -> None:
     self.mc_latency_injection = self.add_server(SleepServer())
     self.mc_shadow1 = self.add_server(SleepServer())
     self.mc_shadow2 = self.add_server(SleepServer())
     self.mcrouter = self.add_mcrouter(self.config_processing_time,
                                       self.default_route, self.extra_args)
Ejemplo n.º 15
0
 def setUp(self):
     # The order here must corresponds to the order of hosts in the .json
     self.add_server(SleepServer())
     self.mcrouter = self.add_mcrouter(self.config,
                                       extra_args=self.extra_args)
Ejemplo n.º 16
0
 def setUp(self):
     self.add_server(SleepServer())
     self.mcrouter = self.add_mcrouter(self.config,
                                       extra_args=self.extra_args)