This commit is contained in:
Liang Guo 2014-01-23 12:18:46 -08:00
Родитель 8889f80e76
Коммит 860b849683
6 изменённых файлов: 16 добавлений и 16 удалений

Просмотреть файл

@ -283,7 +283,7 @@ class TestNocache(framework.TestCase):
def test_query_timeout(self):
vstart = self.env.debug_vars()
conn = tablet_conn.connect("localhost:9461", 'test_keyspace', '0', 5)
conn = tablet_conn.connect("localhost:9461", '', 'test_keyspace', '0', 5)
cu = cursor.TabletCursor(conn)
self.env.execute("set vt_query_timeout=0.25")
try:

Просмотреть файл

@ -30,7 +30,7 @@ class EnvironmentError(Exception):
class TestEnv(object):
def connect(self):
c = tablet_conn.connect("localhost:%s" % self.tablet.port, 'test_keyspace', '0', 2)
c = tablet_conn.connect("localhost:%s" % self.tablet.port, '', 'test_keyspace', '0', 2)
c.max_attempts = 1
return c
@ -367,7 +367,7 @@ class VtoccTestEnv(TestEnv):
pass
def connect(self):
c = tablet_conn.connect("localhost:9461", 'test_keyspace', '0', 2)
c = tablet_conn.connect("localhost:9461", '', 'test_keyspace', '0', 2)
c.max_attempts = 1
return c

Просмотреть файл

@ -10,6 +10,7 @@ import subprocess
import time
import unittest
from vtdb import dbexceptions
from vtdb import tablet as tablet3
from vtdb import topology
from vtdb import vtgate
@ -226,7 +227,7 @@ class TestSecure(unittest.TestCase):
utils.run_vtctl('ReparentShard -force test_keyspace/0 ' + shard_0_master.tablet_alias, auto_log=True)
# then get the topology and check it
zkocc_client = zkocc.ZkOccConnection("localhost:%u" % utils.zkocc_port_base,
zkocc_client = zkocc.ZkOccConnection("localhost:%u" % environment.zkocc_port_base,
"test_nj", 30.0)
topology.read_keyspaces(zkocc_client)
@ -245,10 +246,10 @@ class TestSecure(unittest.TestCase):
# try to connect with regular client
try:
conn = tablet3.TabletConnection("%s:%u" % (shard_0_master_addrs[0][0], shard_0_master_addrs[0][1]),
"test_keyspace", "0", 10.0)
"", "test_keyspace", "0", 10.0)
conn.dial()
self.fail("No exception raised to secure port")
except tablet3.FatalError as e:
except dbexceptions.FatalError as e:
if not e.args[0][0].startswith('Unexpected EOF in handshake to'):
self.fail("Unexpected exception: %s" % str(e))
@ -258,7 +259,7 @@ class TestSecure(unittest.TestCase):
# connect to encrypted port
conn = tablet3.TabletConnection("%s:%u" % (shard_0_master_addrs[0][0], shard_0_master_addrs[0][1]),
"test_keyspace", "0", 5.0, encrypted=True)
"", "test_keyspace", "0", 5.0, encrypted=True)
conn.dial()
(results, rowcount, lastrowid, fields) = conn._execute("select 1 from dual", {})
self.assertEqual(results, [(1,),], 'wrong conn._execute output: %s' % str(results))
@ -274,7 +275,7 @@ class TestSecure(unittest.TestCase):
try:
conn._execute("select sleep(100) from dual", {})
self.fail("No timeout exception")
except tablet3.TimeoutError as e:
except dbexceptions.TimeoutError as e:
logging.debug("Got the right exception for SSL timeout: %s", str(e))
# start a vtgate to connect to that tablet

Просмотреть файл

@ -217,7 +217,7 @@ class TestSharded(unittest.TestCase):
# now try to connect using the python client and shard-aware connection
# to both shards
# first get the topology and check it
zkocc_client = zkocc.ZkOccConnection("localhost:%u" % utils.zkocc_port_base,
zkocc_client = zkocc.ZkOccConnection("localhost:%u" % environment.zkocc_port_base,
"test_nj", 30.0)
topology.read_keyspaces(zkocc_client)
@ -229,7 +229,7 @@ class TestSharded(unittest.TestCase):
# connect to shard -80
conn = tablet3.TabletConnection("%s:%u" % (shard_0_master_addrs[0][0],
shard_0_master_addrs[0][1]),
"test_keyspace", "-80", 10.0)
"", "test_keyspace", "-80", 10.0)
conn.dial()
(results, rowcount, lastrowid, fields) = conn._execute("select id, msg from vt_select_test order by id", {})
self.assertEqual(results, [(1, 'test 1'), (2, 'test 2'), ],
@ -239,7 +239,7 @@ class TestSharded(unittest.TestCase):
shard_1_master_addrs = topology.get_host_port_by_name(zkocc_client, "test_keyspace.80-.master:_vtocc")
conn = tablet3.TabletConnection("%s:%u" % (shard_1_master_addrs[0][0],
shard_1_master_addrs[0][1]),
"test_keyspace", "80-", 10.0)
"", "test_keyspace", "80-", 10.0)
conn.dial()
(results, rowcount, lastrowid, fields) = conn._execute("select id, msg from vt_select_test order by id", {})
self.assertEqual(results, [(10, 'test 10'), ],
@ -248,7 +248,7 @@ class TestSharded(unittest.TestCase):
# try to connect with bad shard
try:
conn = tablet3.TabletConnection("localhost:%u" % shard_0_master.port,
"test_keyspace", "-90", 10.0)
"", "test_keyspace", "-90", 10.0)
conn.dial()
self.fail('expected an exception')
except Exception as e:

Просмотреть файл

@ -27,7 +27,7 @@ master_tablet = tablet.Tablet(62344)
replica_tablet = tablet.Tablet(62345)
master_host = "localhost:%u" % master_tablet.port
replica_host = "localhost:%u" % replica_tablet.port
zkocc_client = zkocc.ZkOccConnection("localhost:%u" % utils.zkocc_port_base,
zkocc_client = zkocc.ZkOccConnection("localhost:%u" % environment.zkocc_port_base,
"test_nj", 30.0)
master_start_position = None

Просмотреть файл

@ -14,7 +14,6 @@ import utils
from net import gorpc
from vtdb import cursor
from vtdb import tablet as tablet3
from vtdb import vtclient
from vtdb import dbexceptions
from zk import zkocc
@ -366,14 +365,14 @@ class TestFailures(unittest.TestCase):
replica_conn = get_replica_connection()
except Exception, e:
self.fail("Connection to shard0 replica failed with error %s" % str(e))
with self.assertRaises(tablet3.TimeoutError):
with self.assertRaises(dbexceptions.TimeoutError):
replica_conn._execute("select sleep(12) from dual", {})
try:
master_conn = get_master_connection()
except Exception, e:
self.fail("Connection to shard0 master failed with error %s" % str(e))
with self.assertRaises(tablet3.TimeoutError):
with self.assertRaises(dbexceptions.TimeoutError):
master_conn._execute("select sleep(12) from dual", {})
def test_restart_mysql_failure(self):