зеркало из https://github.com/github/vitess-gh.git
Making rpc_timeout_message part of the protocols_flavor object.
Since it depends on the protocol, really.
This commit is contained in:
Родитель
9b7ed1bbff
Коммит
819c080383
|
@ -39,9 +39,6 @@ status_url = '/debug/status'
|
|||
# location of the curl binary, used for some tests.
|
||||
curl_bin = '/usr/bin/curl'
|
||||
|
||||
# when an RPC times out, this message will be in the logs
|
||||
rpc_timeout_message = 'Timeout waiting for'
|
||||
|
||||
def memcached_bin():
|
||||
in_vt = os.path.join(vtroot, 'bin', 'memcached')
|
||||
if os.path.exists(in_vt):
|
||||
|
|
|
@ -7,6 +7,7 @@ import shlex
|
|||
from subprocess import Popen, PIPE
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import utils
|
||||
|
||||
class TestCase(unittest.TestCase):
|
||||
|
|
|
@ -22,6 +22,10 @@ class ProtocolsFlavor(object):
|
|||
"""Returns the flags to use for specifying the query service protocol."""
|
||||
return ['-tablet_protocol', 'gorpc']
|
||||
|
||||
def rpc_timeout_message(self):
|
||||
"""Returns the error message used by the protocol to indicate a timeout."""
|
||||
return 'BASE CLASS MESSAGE'
|
||||
|
||||
class GoRpcProtocolsFlavor(ProtocolsFlavor):
|
||||
"""Overrides to use go rpc everywhere"""
|
||||
|
||||
|
@ -37,6 +41,9 @@ class GoRpcProtocolsFlavor(ProtocolsFlavor):
|
|||
def tabletconn_protocol_flags(self):
|
||||
return ['-tablet_protocol', 'gorpc']
|
||||
|
||||
def rpc_timeout_message(self):
|
||||
return 'Timeout waiting for'
|
||||
|
||||
__knows_protocols_flavor_map = {
|
||||
'gorpc': GoRpcProtocolsFlavor,
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import environment
|
|||
import utils
|
||||
import tablet
|
||||
from mysql_flavor import mysql_flavor
|
||||
from protocols_flavor import protocols_flavor
|
||||
|
||||
tablet_62344 = tablet.Tablet(62344)
|
||||
tablet_62044 = tablet.Tablet(62044)
|
||||
|
@ -163,7 +164,7 @@ class TestReparent(unittest.TestCase):
|
|||
tablet_62344.tablet_alias],
|
||||
expect_fail=True)
|
||||
logging.debug('Failed ScrapTablet output:\n' + stderr)
|
||||
if 'connection refused' not in stderr and environment.rpc_timeout_message not in stderr:
|
||||
if 'connection refused' not in stderr and protocols_flavor().rpc_timeout_message() not in stderr:
|
||||
self.fail("didn't find the right error strings in failed ScrapTablet: " +
|
||||
stderr)
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ class TestTabletManager(unittest.TestCase):
|
|||
stdout, stderr = utils.run_vtctl(['-wait-time', '3s',
|
||||
'RefreshState', tablet_62344.tablet_alias],
|
||||
expect_fail=True)
|
||||
self.assertIn(environment.rpc_timeout_message, stderr)
|
||||
self.assertIn(protocols_flavor().rpc_timeout_message(), stderr)
|
||||
|
||||
# wait for the background vtctl
|
||||
bg.wait()
|
||||
|
|
Загрузка…
Ссылка в новой задаче