зеркало из https://github.com/github/vitess-gh.git
Fixing a bunch of linter errors.
This commit is contained in:
Родитель
e7f8647f00
Коммит
4954056bdd
|
@ -153,9 +153,9 @@ class TestBackup(unittest.TestCase):
|
|||
timeout = utils.wait_step('new slave tablet getting data', timeout)
|
||||
|
||||
# list the backups
|
||||
backups, err = utils.run_vtctl(tablet.get_backup_storage_flags() +
|
||||
['ListBackups', 'test_keyspace/0'],
|
||||
mode=utils.VTCTL_VTCTL, trap_output=True)
|
||||
backups, _ = utils.run_vtctl(tablet.get_backup_storage_flags() +
|
||||
['ListBackups', 'test_keyspace/0'],
|
||||
mode=utils.VTCTL_VTCTL, trap_output=True)
|
||||
backups = backups.splitlines()
|
||||
logging.debug('list of backups: %s', backups)
|
||||
self.assertEqual(len(backups), 1)
|
||||
|
|
|
@ -198,7 +198,8 @@ class TestBinlog(unittest.TestCase):
|
|||
# Insert something and make sure it comes through intact.
|
||||
sql = (
|
||||
"INSERT INTO test_table (id, keyspace_id, msg) "
|
||||
"VALUES (19283, 1, 'testing checksum enabled') /* vtgate:: keyspace_id:00000001 */")
|
||||
"VALUES (19283, 1, 'testing checksum enabled') "
|
||||
"/* vtgate:: keyspace_id:00000001 */")
|
||||
src_master.mquery('vt_test_keyspace', sql, write=True)
|
||||
|
||||
# Look for it using update stream to see if binlog streamer can talk to
|
||||
|
|
|
@ -14,11 +14,8 @@
|
|||
# - we remove the source tablets
|
||||
# - we remove the original shard
|
||||
|
||||
import base64
|
||||
import logging
|
||||
import threading
|
||||
import struct
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from vtdb import keyrange_constants
|
||||
|
@ -168,7 +165,8 @@ index by_msg (msg)
|
|||
'vt_test_keyspace',
|
||||
['begin',
|
||||
'insert into %s(id, msg, keyspace_id) '
|
||||
'values(%d, "%s", 0x%x) /* vtgate:: keyspace_id:%s */ /* user_id:%d */' %
|
||||
'values(%d, "%s", 0x%x) /* vtgate:: keyspace_id:%s */ '
|
||||
'/* user_id:%d */' %
|
||||
(table, id, msg, keyspace_id, k, id),
|
||||
'commit'],
|
||||
write=True)
|
||||
|
|
|
@ -5,7 +5,6 @@ import unittest
|
|||
import utils
|
||||
|
||||
from vtdb import dbexceptions
|
||||
from vtdb import keyspace
|
||||
from vtdb import keyrange
|
||||
from vtdb import keyrange_constants
|
||||
from vtdb import vtrouting
|
||||
|
@ -79,7 +78,7 @@ class TestKeyRange(unittest.TestCase):
|
|||
def test_incorrect_tasks(self):
|
||||
global_shard_count = 16
|
||||
with self.assertRaises(dbexceptions.ProgrammingError):
|
||||
stm = vtrouting.create_parallel_task_keyrange_map(4, global_shard_count)
|
||||
vtrouting.create_parallel_task_keyrange_map(4, global_shard_count)
|
||||
|
||||
def test_keyranges_for_tasks(self):
|
||||
for shard_count in (16, 32, 64):
|
||||
|
|
|
@ -5,7 +5,6 @@ import warnings
|
|||
# the "IF EXISTS" clause. Squelch these warnings.
|
||||
warnings.simplefilter('ignore')
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
import environment
|
||||
|
|
|
@ -4,15 +4,12 @@
|
|||
# Use of this source code is governed by a BSD-style license that can
|
||||
# be found in the LICENSE file.
|
||||
|
||||
import base64
|
||||
import json
|
||||
import logging
|
||||
import struct
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from vtdb import dbexceptions
|
||||
from vtdb import keyrange_constants
|
||||
|
||||
import environment
|
||||
|
@ -366,7 +363,6 @@ primary key (name)
|
|||
|
||||
# _check_lots_not_present makes sure no data is in the wrong shard
|
||||
def _check_lots_not_present(self, count, base=0):
|
||||
found = 0
|
||||
for i in xrange(count):
|
||||
self._check_value(shard_3_replica, 'resharding1', 10000 + base + i,
|
||||
'msg-range1-%d' % i, 0xA000000000000000 + base + i,
|
||||
|
@ -688,7 +684,6 @@ primary key (name)
|
|||
utils.check_tablet_query_service(self, shard_1_rdonly1, False, True)
|
||||
|
||||
# then serve replica from the split shards
|
||||
source_tablet = shard_1_slave2
|
||||
destination_shards = ['test_keyspace/80-c0', 'test_keyspace/c0-']
|
||||
|
||||
utils.run_vtctl(['MigrateServedTypes', 'test_keyspace/80-', 'replica'],
|
||||
|
|
|
@ -140,7 +140,7 @@ class Tablet(object):
|
|||
args.extend(cmd)
|
||||
return utils.run_bg(args, extra_env=extra_env)
|
||||
|
||||
def mysqlctld(self, cmd, extra_my_cnf=None, with_ports=False, verbose=False):
|
||||
def mysqlctld(self, cmd, extra_my_cnf=None, verbose=False):
|
||||
extra_env = {}
|
||||
all_extra_my_cnf = get_all_extra_my_cnf(extra_my_cnf)
|
||||
if all_extra_my_cnf:
|
||||
|
|
|
@ -175,7 +175,7 @@ class TestTabletManager(unittest.TestCase):
|
|||
|
||||
# try a frontend RefreshState that should timeout as the tablet is busy
|
||||
# running the other one
|
||||
stdout, stderr = utils.run_vtctl(
|
||||
_, stderr = utils.run_vtctl(
|
||||
['-wait-time', '3s', 'RefreshState', tablet_62344.tablet_alias],
|
||||
expect_fail=True)
|
||||
self.assertIn(protocols_flavor().rpc_timeout_message(), stderr)
|
||||
|
@ -226,6 +226,7 @@ class TestTabletManager(unittest.TestCase):
|
|||
self.assertFail(
|
||||
'cannot find expected %s in %s' %
|
||||
(str(expectedStdout), hr['Stdout']))
|
||||
self.assertEqual(hr['Stderr'], expectedStderr)
|
||||
|
||||
def test_hook(self):
|
||||
utils.run_vtctl(['CreateKeyspace', 'test_keyspace'])
|
||||
|
@ -298,8 +299,8 @@ class TestTabletManager(unittest.TestCase):
|
|||
|
||||
tablet_62344.init_tablet('master', 'test_keyspace', '0')
|
||||
proc1 = tablet_62344.start_vttablet()
|
||||
proc2 = tablet_62344.start_vttablet()
|
||||
for timeout in xrange(20):
|
||||
tablet_62344.start_vttablet()
|
||||
for _ in xrange(20):
|
||||
logging.debug('Sleeping waiting for first process to die')
|
||||
time.sleep(1.0)
|
||||
proc1.poll()
|
||||
|
@ -657,7 +658,7 @@ class TestTabletManager(unittest.TestCase):
|
|||
def test_fallback_policy(self):
|
||||
tablet_62344.create_db('vt_test_keyspace')
|
||||
tablet_62344.init_tablet('master', 'test_keyspace', '0')
|
||||
proc1 = tablet_62344.start_vttablet(security_policy='bogus')
|
||||
tablet_62344.start_vttablet(security_policy='bogus')
|
||||
f = urllib.urlopen('http://localhost:%d/queryz' % int(tablet_62344.port))
|
||||
response = f.read()
|
||||
f.close()
|
||||
|
|
|
@ -171,7 +171,7 @@ class TestUpdateStream(unittest.TestCase):
|
|||
logging.debug('dialing replica update stream service')
|
||||
replica_conn = self._get_replica_stream_conn()
|
||||
try:
|
||||
for stream_event in replica_conn.stream_update(start_position):
|
||||
for _ in replica_conn.stream_update(start_position):
|
||||
break
|
||||
except Exception as e:
|
||||
self.assertIn('update stream service is not enabled', str(e))
|
||||
|
@ -183,7 +183,7 @@ class TestUpdateStream(unittest.TestCase):
|
|||
v['UpdateStreamState'])
|
||||
|
||||
def perform_writes(self, count):
|
||||
for i in xrange(count):
|
||||
for _ in xrange(count):
|
||||
self._exec_vt_txn(self._populate_vt_insert_test)
|
||||
self._exec_vt_txn(['delete from vt_insert_test'])
|
||||
|
||||
|
@ -277,8 +277,6 @@ class TestUpdateStream(unittest.TestCase):
|
|||
)
|
||||
logging.debug('run_test_stream_parity starting @ %s',
|
||||
master_start_position)
|
||||
master_txn_count = 0
|
||||
replica_txn_count = 0
|
||||
self._exec_vt_txn(self._populate_vt_a(15))
|
||||
self._exec_vt_txn(self._populate_vt_b(14))
|
||||
self._exec_vt_txn(['delete from vt_a'])
|
||||
|
|
|
@ -854,7 +854,7 @@ def check_db_read_write(uid):
|
|||
|
||||
|
||||
def wait_db_read_only(uid):
|
||||
for x in xrange(3):
|
||||
for _ in xrange(3):
|
||||
try:
|
||||
check_db_read_only(uid)
|
||||
return
|
||||
|
|
|
@ -214,7 +214,7 @@ index by_msg (msg)
|
|||
qr['Rows'][0][0], t, tablet.tablet_alias)
|
||||
|
||||
def _check_client_conn_redirection(
|
||||
self, source_ks, destination_ks, db_types, servedfrom_db_types,
|
||||
self, destination_ks, servedfrom_db_types,
|
||||
moved_tables=None):
|
||||
# check that the ServedFrom indirection worked correctly.
|
||||
if moved_tables is None:
|
||||
|
@ -463,7 +463,7 @@ index by_msg (msg)
|
|||
self._check_blacklisted_tables(source_rdonly1, ['moving.*', 'view1'])
|
||||
self._check_blacklisted_tables(source_rdonly2, ['moving.*', 'view1'])
|
||||
self._check_client_conn_redirection(
|
||||
'source_keyspace', 'destination_keyspace', ['rdonly'],
|
||||
'destination_keyspace',
|
||||
['master', 'replica'], ['moving1', 'moving2'])
|
||||
|
||||
# then serve replica from the destination shards
|
||||
|
@ -475,7 +475,7 @@ index by_msg (msg)
|
|||
self._check_blacklisted_tables(source_rdonly1, ['moving.*', 'view1'])
|
||||
self._check_blacklisted_tables(source_rdonly2, ['moving.*', 'view1'])
|
||||
self._check_client_conn_redirection(
|
||||
'source_keyspace', 'destination_keyspace', ['replica', 'rdonly'],
|
||||
'destination_keyspace',
|
||||
['master'], ['moving1', 'moving2'])
|
||||
|
||||
# move replica back and forth
|
||||
|
@ -495,7 +495,7 @@ index by_msg (msg)
|
|||
self._check_blacklisted_tables(source_rdonly1, ['moving.*', 'view1'])
|
||||
self._check_blacklisted_tables(source_rdonly2, ['moving.*', 'view1'])
|
||||
self._check_client_conn_redirection(
|
||||
'source_keyspace', 'destination_keyspace', ['replica', 'rdonly'],
|
||||
'destination_keyspace',
|
||||
['master'], ['moving1', 'moving2'])
|
||||
|
||||
# then serve master from the destination shards
|
||||
|
@ -507,8 +507,8 @@ index by_msg (msg)
|
|||
self._check_blacklisted_tables(source_rdonly1, ['moving.*', 'view1'])
|
||||
self._check_blacklisted_tables(source_rdonly2, ['moving.*', 'view1'])
|
||||
self._check_client_conn_redirection(
|
||||
'source_keyspace', 'destination_keyspace',
|
||||
['replica', 'rdonly', 'master'], [], ['moving1', 'moving2'])
|
||||
'destination_keyspace',
|
||||
[], ['moving1', 'moving2'])
|
||||
|
||||
# check 'vtctl SetShardTabletControl' command works as expected:
|
||||
# clear the rdonly entry, re-add it, and then clear all entries.
|
||||
|
|
|
@ -134,8 +134,8 @@ class TestVtctld(unittest.TestCase):
|
|||
self._check_all_tablets(out)
|
||||
|
||||
# python RPC client to vtctld
|
||||
out, err = utils.run_vtctl(['ListAllTablets', 'test_nj'],
|
||||
mode=utils.VTCTL_RPC)
|
||||
out, _ = utils.run_vtctl(['ListAllTablets', 'test_nj'],
|
||||
mode=utils.VTCTL_RPC)
|
||||
self._check_all_tablets(out)
|
||||
|
||||
def test_assigned(self):
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
import hmac
|
||||
import json
|
||||
import logging
|
||||
from multiprocessing.pool import ThreadPool
|
||||
import os
|
||||
import pprint
|
||||
import struct
|
||||
import threading
|
||||
|
@ -473,7 +470,7 @@ class TestCoreVTGateFunctions(BaseTestCase):
|
|||
KEYSPACE_NAME, 'master',
|
||||
keyranges=[self.keyrange])
|
||||
self.assertEqual(rowcount, count)
|
||||
results, rowcount, _, _ = vtgate_conn._execute(
|
||||
_, rowcount, _, _ = vtgate_conn._execute(
|
||||
'select * from vt_a', {},
|
||||
KEYSPACE_NAME, 'master',
|
||||
keyranges=[self.keyrange])
|
||||
|
@ -675,7 +672,7 @@ class TestCoreVTGateFunctions(BaseTestCase):
|
|||
query = 'select * from vt_field_types where uint_val in %(uint_val_1)s'
|
||||
rowcount = cursor.execute(query, {'uint_val_1': uint_val_list})
|
||||
self.assertEqual(rowcount, len(uint_val_list), "rowcount doesn't match")
|
||||
for i, r in enumerate(cursor.results):
|
||||
for _, r in enumerate(cursor.results):
|
||||
row = DBRow(field_names, r)
|
||||
self.assertIsInstance(row.uint_val, long)
|
||||
self.assertGreaterEqual(
|
||||
|
|
|
@ -715,7 +715,7 @@ class TestVTGateFunctions(unittest.TestCase):
|
|||
'update vt_user_extra set email=:v2 where user_id = :v1',
|
||||
bindvars=[10, 'test 1000'])
|
||||
|
||||
out, err = utils.vtgate.vtclient(
|
||||
out, _ = utils.vtgate.vtclient(
|
||||
'select * from vt_user_extra where user_id = :v1', bindvars=[10],
|
||||
streaming=True)
|
||||
self.assertEqual(out, ['Index\tuser_id\temail', '0\t10\ttest 1000'])
|
||||
|
|
Загрузка…
Ссылка в новой задаче