Changing integration tests to use InitShardMaster.

This commit is contained in:
Alain Jobart 2015-04-02 09:07:41 -07:00
Родитель 9021d308c7
Коммит 8fd2ff4ba3
14 изменённых файлов: 28 добавлений и 25 удалений

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

@ -66,7 +66,7 @@ def setUpModule():
for t in [src_master, src_replica, src_rdonly1, src_rdonly2]:
t.wait_for_vttablet_state('SERVING')
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/0',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/0',
src_master.tablet_alias], auto_log=True)
# Create schema

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

@ -143,10 +143,10 @@ def start_tablets():
for t in __tablets:
t.wait_for_vttablet_state('SERVING')
# ReparentShard for master tablets
# InitShardMaster for master tablets
for t in __tablets:
if t.tablet_type == 'master':
utils.run_vtctl(['ReparentShard', '-force', t.keyspace+'/'+t.shard,
utils.run_vtctl(['InitShardMaster', t.keyspace+'/'+t.shard,
t.tablet_alias], auto_log=True)
for ks in topo_schema.keyspaces:

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

@ -303,7 +303,7 @@ index by_msg (msg)
shard_rdonly1.wait_for_vttablet_state('SERVING')
# reparent to make the tablets work
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/0',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/0',
shard_master.tablet_alias], auto_log=True)
# create the tables and add startup values

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

@ -71,7 +71,7 @@ class TestEnv(object):
t.wait_for_vttablet_state('SERVING')
for t in self.tablets:
if t.type == "master":
utils.run_vtctl(['ReparentShard', '-force', self.keyspace+'/'+t.shard, t.tablet_alias], auto_log=True)
utils.run_vtctl(['InitShardMaster', self.keyspace+'/'+t.shard, t.tablet_alias], auto_log=True)
utils.run_vtctl(['RebuildKeyspaceGraph', self.keyspace], auto_log=True)
if self.schema:
utils.run_vtctl(['ApplySchemaKeyspace', '-simple', '-sql', self.schema, self.keyspace])
@ -129,4 +129,3 @@ def main():
if __name__ == '__main__':
parse_args()
main()

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

@ -135,9 +135,9 @@ def setup_sharded_keyspace():
for t in [shard_0_master, shard_0_replica, shard_1_master, shard_1_replica]:
t.wait_for_vttablet_state('SERVING')
utils.run_vtctl(['ReparentShard', '-force', '%s/-80' % SHARDED_KEYSPACE,
utils.run_vtctl(['InitShardMaster', '%s/-80' % SHARDED_KEYSPACE,
shard_0_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ReparentShard', '-force', '%s/80-' % SHARDED_KEYSPACE,
utils.run_vtctl(['InitShardMaster', '%s/80-' % SHARDED_KEYSPACE,
shard_1_master.tablet_alias], auto_log=True)
utils.run_vtctl(['RebuildKeyspaceGraph', SHARDED_KEYSPACE],
@ -166,7 +166,7 @@ def setup_unsharded_keyspace():
for t in [unsharded_master, unsharded_replica]:
t.wait_for_vttablet_state('SERVING')
utils.run_vtctl(['ReparentShard', '-force', '%s/0' % UNSHARDED_KEYSPACE,
utils.run_vtctl(['InitShardMaster', '%s/0' % UNSHARDED_KEYSPACE,
unsharded_master.tablet_alias], auto_log=True)
utils.run_vtctl(['RebuildKeyspaceGraph', UNSHARDED_KEYSPACE],

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

@ -47,7 +47,8 @@ class TestEnv(object):
t.wait_for_vttablet_state('SERVING')
for t in self.tablets:
if t.tablet_type == "master":
utils.run_vtctl(['ReparentShard', '-force', keyspace+'/'+t.shard, t.tablet_alias], auto_log=True)
utils.run_vtctl(['InitShardMaster', keyspace+'/'+t.shard,
t.tablet_alias], auto_log=True)
# Force read-write even if there are no replicas.
utils.run_vtctl(['SetReadWrite', t.tablet_alias], auto_log=True)

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

@ -63,7 +63,7 @@ def setUpModule():
master_tablet.wait_for_vttablet_state('SERVING')
replica_tablet.wait_for_vttablet_state('SERVING')
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/0',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/0',
master_tablet.tablet_alias], auto_log=True)
utils.validate_topology()

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

@ -136,9 +136,12 @@ class TestSchema(unittest.TestCase):
for t in [shard_0_master, shard_0_replica1, shard_0_replica2,
shard_0_rdonly, shard_0_backup, shard_1_master, shard_1_replica1, shard_2_master, shard_2_replica1]:
t.reset_replication()
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/0', shard_0_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/1', shard_1_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/2', shard_2_master.tablet_alias], auto_log=True)
utils.run_vtctl(['InitShardMaster', 'test_keyspace/0',
shard_0_master.tablet_alias], auto_log=True)
utils.run_vtctl(['InitShardMaster', 'test_keyspace/1',
shard_1_master.tablet_alias], auto_log=True)
utils.run_vtctl(['InitShardMaster', 'test_keyspace/2',
shard_2_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ValidateKeyspace', '-ping-tablets', 'test_keyspace'])
# check after all tablets are here and replication is fixed

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

@ -123,9 +123,9 @@ class TestSharded(unittest.TestCase):
for t in [shard_0_master, shard_0_replica, shard_1_master, shard_1_replica]:
t.reset_replication()
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/-80',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/-80',
shard_0_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/80-',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/80-',
shard_1_master.tablet_alias], auto_log=True)
# apply the schema on the second shard using a simple schema upgrade

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

@ -101,7 +101,7 @@ def setUpModule():
for t in [master_tablet, replica_tablet]:
t.reset_replication()
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/0',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/0',
master_tablet.tablet_alias], auto_log=True)
# reset counter so tests don't assert

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

@ -293,9 +293,9 @@ index by_msg (msg)
t.wait_for_vttablet_state('NOT_SERVING')
# reparent to make the tablets work
utils.run_vtctl(['ReparentShard', '-force', 'source_keyspace/0',
utils.run_vtctl(['InitShardMaster', 'source_keyspace/0',
source_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ReparentShard', '-force', 'destination_keyspace/0',
utils.run_vtctl(['InitShardMaster', 'destination_keyspace/0',
destination_master.tablet_alias], auto_log=True)
# read all the keyspaces, this will populate the topology cache.

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

@ -108,9 +108,9 @@ class TestVtctld(unittest.TestCase):
for t in [shard_0_master, shard_0_replica, shard_0_spare,
shard_1_master, shard_1_replica, idle, scrap]:
t.reset_replication()
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/-80',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/-80',
shard_0_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/80-',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/80-',
shard_1_master.tablet_alias], auto_log=True)
shard_0_replica.wait_for_vttablet_state('SERVING')

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

@ -135,9 +135,9 @@ def setup_tablets():
for t in [shard_0_master, shard_0_replica, shard_1_master, shard_1_replica]:
t.wait_for_vttablet_state('SERVING')
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/-80',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/-80',
shard_0_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/80-',
utils.run_vtctl(['InitShardMaster', 'test_keyspace/80-',
shard_1_master.tablet_alias], auto_log=True)
utils.run_vtctl(['RebuildKeyspaceGraph', 'test_keyspace'],

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

@ -153,9 +153,9 @@ def setup_tablets():
shard_1_master, shard_1_replica1, shard_1_replica2]:
t.wait_for_vttablet_state('SERVING')
utils.run_vtctl(['ReparentShard', '-force', KEYSPACE_NAME+'/-80',
utils.run_vtctl(['InitShardMaster', KEYSPACE_NAME+'/-80',
shard_0_master.tablet_alias], auto_log=True)
utils.run_vtctl(['ReparentShard', '-force', KEYSPACE_NAME+'/80-',
utils.run_vtctl(['InitShardMaster', KEYSPACE_NAME+'/80-',
shard_1_master.tablet_alias], auto_log=True)
utils.run_vtctl(['RebuildKeyspaceGraph', KEYSPACE_NAME],