Exemple #1
0
def main():
    parser = optparse.OptionParser(usage="usage: %prog [options]")
    parser.add_option(
        "--shards",
        action="store",
        type="string",
        help="comma separated list of shard names, e.g: '-80,80-'")
    parser.add_option(
        "--tablet-config",
        action="store",
        type="string",
        help=
        "json config for for non-master tablets. e.g {'replica':2, 'rdonly':1}"
    )
    parser.add_option("--keyspace", action="store", type="string")
    parser.add_option("--schema", action="store", type="string")
    parser.add_option("--vschema", action="store", type="string")
    utils.add_options(parser)
    (options, args) = parser.parse_args()
    utils.set_options(options)
    env = TestEnv(options)
    if args[0] == 'setup':
        env.set_up()
        sys.stdout.write(json.dumps({
            "port": env.vtgate_port,
        }) + "\n")
        sys.stdout.flush()
    elif args[0] == 'teardown':
        env.shutdown()
Exemple #2
0
def main():
  parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
  parser.add_option('-m', '--memcache', action='store_true', default=False,
                    help='starts a memcache d, and tests rowcache')
  utils.add_options(parser)
  options, args = parser.parse_args()

  logging.getLogger().setLevel(logging.ERROR)
  utils.set_options(options)

  run_tests(options, args)
Exemple #3
0
def main():
  parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
  parser.add_option("-m", "--memcache", action="store_true", default=False,
                    help="starts a memcache d, and tests rowcache")
  parser.add_option("-e", "--env", default='vttablet',
                    help="Environment that will be used. Valid options: vttablet, vtocc")
  utils.add_options(parser)
  (options, args) = parser.parse_args()

  logging.getLogger().setLevel(logging.ERROR)
  utils.set_options(options)

  run_tests(options, args)
Exemple #4
0
def main():
    parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
    parser.add_option('-m',
                      '--memcache',
                      action='store_true',
                      default=False,
                      help='starts a memcache d, and tests rowcache')
    utils.add_options(parser)
    options, args = parser.parse_args()

    logging.getLogger().setLevel(logging.ERROR)
    utils.set_options(options)

    run_tests(options, args)
def main():
  parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
  parser.add_option('-m', '--memcache', action='store_true', default=False,
                    help='starts a memcache d, and tests rowcache')
  parser.add_option(
      '-e', '--env', default='vttablet',
      help='Environment that will be used. Valid options: vttablet, vtocc')
  utils.add_options(parser)
  (options, args) = parser.parse_args()

  logging.getLogger().setLevel(logging.ERROR)
  utils.set_options(options)

  run_tests(options, args)
def parse_args():
  global options, args
  parser = optparse.OptionParser(usage="usage: %prog [options]")
  parser.add_option("--shards", action="store", type="string",
                    help="comma separated list of shard names, e.g: '-80,80-'")
  parser.add_option("--tablet-config", action="store", type="string",
                    help="json config for for non-master tablets. e.g {'replica':2, 'rdonly':1}")
  parser.add_option("--keyspace", action="store", type="string")
  parser.add_option("--schema", action="store", type="string")
  parser.add_option("--vschema", action="store", type="string")
  parser.add_option("--vtgate-port", action="store", type="int")
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  utils.set_options(options)
Exemple #7
0
def main():
    parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
    parser.add_option(
        "-m", "--memcache", action="store_true", default=False, help="starts a memcache d, and tests rowcache"
    )
    parser.add_option(
        "-e", "--env", default="vttablet", help="Environment that will be used. Valid options: vttablet, vtocc"
    )
    utils.add_options(parser)
    options, args = parser.parse_args()

    logging.getLogger().setLevel(logging.ERROR)
    utils.set_options(options)

    run_tests(options, args)
def parse_args():
  global options, args
  parser = optparse.OptionParser(usage='usage: %prog [options]')
  parser.add_option('--shards', action='store', type='string',
                    help="comma separated list of shard names, e.g: '-80,80-'")
  parser.add_option(
      '--tablet-config', action='store', type='string',
      help='json config for for non-master tablets. e.g '
      "{'replica':2, 'rdonly':1}")
  parser.add_option('--keyspace', action='store', type='string')
  parser.add_option('--dbname-override', action='store', type='string')
  parser.add_option('--schema', action='store', type='string')
  parser.add_option('--vschema', action='store', type='string')
  parser.add_option('--vtgate-port', action='store', type='int')
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  utils.set_options(options)
Exemple #9
0
def main():
    parser = optparse.OptionParser(usage='usage: %prog [options]')
    utils.add_options(parser)
    (options, args) = parser.parse_args()
    options.debug = True
    utils.set_options(options)
    env = keyspace_util.TestEnv()
    try:
        environment.topo_server().setup()
        env.launch(
            'user',
            shards=['-80', '80-'],
            ddls=[
                'create table user(user_id bigint, name varchar(128), '
                'primary key(user_id))',
                'create table user_extra(user_id bigint, extra varchar(128), '
                'primary key(user_id))',
                'create table music(user_id bigint, music_id bigint, '
                'primary key(user_id, music_id))',
                'create table music_extra(music_id bigint, '
                'keyspace_id bigint unsigned, primary key(music_id))',
            ],
        )
        env.launch(
            'lookup',
            ddls=[
                'create table user_idx(user_id bigint not null auto_increment, '
                'primary key(user_id))',
                'create table name_user_idx(name varchar(128), user_id bigint, '
                'primary key(name, user_id))',
                'create table music_user_idx(music_id bigint not null '
                'auto_increment, user_id bigint, primary key(music_id))',
            ],
        )
        utils.apply_vschema(vschema)
        utils.VtGate().start(cache_ttl='500s')
        utils.Vtctld().start()
        print 'vtgate:', utils.vtgate.port
        print 'vtctld:', utils.vtctld.port
        utils.pause('the cluster is up, press enter to shut it down...')
    finally:
        env.teardown()
        utils.kill_sub_processes()
        utils.remove_tmp_files()
        environment.topo_server().teardown()
Exemple #10
0
def main():
  parser = optparse.OptionParser(usage='usage: %prog [options]')
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  options.debug = True
  utils.set_options(options)
  env = keyspace_util.TestEnv()
  try:
    environment.topo_server().setup()
    env.launch(
        'user',
        shards=['-80', '80-'],
        ddls=[
            'create table user(user_id bigint, name varchar(128), '
            'primary key(user_id))',
            'create table user_extra(user_id bigint, extra varchar(128), '
            'primary key(user_id))',
            'create table music(user_id bigint, music_id bigint, '
            'primary key(user_id, music_id))',
            'create table music_extra(music_id bigint, '
            'keyspace_id bigint unsigned, primary key(music_id))',
            ],
        )
    env.launch(
        'lookup',
        ddls=[
            'create table user_idx(user_id bigint not null auto_increment, '
            'primary key(user_id))',
            'create table name_user_idx(name varchar(128), user_id bigint, '
            'primary key(name, user_id))',
            'create table music_user_idx(music_id bigint not null '
            'auto_increment, user_id bigint, primary key(music_id))',
            ],
        )
    utils.apply_vschema(vschema)
    utils.VtGate().start(cache_ttl='500s')
    utils.Vtctld().start()
    print 'vtgate:', utils.vtgate.port
    print 'vtctld:', utils.vtctld.port
    utils.pause('the cluster is up, press enter to shut it down...')
  finally:
    env.teardown()
    utils.kill_sub_processes()
    utils.remove_tmp_files()
    environment.topo_server().teardown()
Exemple #11
0
def main():
  parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
  parser.add_option('-e', '--environment_type', help='Environment type',
                    default=None)
  parser.add_option('-n', '--name', help='Environment name', default=None)
  parser.add_option('-p', '--environment_params',
                    help='Environment parameters if creating an environment '
                    'for the test', default=None)
  parser.add_option('-t', '--test_params', help='Test parameters',
                    default=None)
  utils.add_options(parser)
  global _options
  _options, args = parser.parse_args()
  del sys.argv[1:]

  utils.set_log_level(_options.verbose)
  utils.set_options(_options)
  unittest.main()
Exemple #12
0
def main():
    parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
    parser.add_option('-m',
                      '--memcache',
                      action='store_true',
                      default=False,
                      help='starts a memcache d, and tests rowcache')
    parser.add_option(
        '-e',
        '--env',
        default='vttablet',
        help='Environment that will be used. Valid options: vttablet, vtocc')
    utils.add_options(parser)
    options, args = parser.parse_args()

    logging.getLogger().setLevel(logging.ERROR)
    utils.set_options(options)

    run_tests(options, args)
def main():
  parser = optparse.OptionParser(usage="usage: %prog [options]")
  parser.add_option("--shards", action="store", type="string",
                    help="comma separated list of shard names, e.g: '-80,80-'")
  parser.add_option("--tablet-config", action="store", type="string",
                    help="json config for for non-master tablets. e.g {'replica':2, 'rdonly':1}")
  parser.add_option("--keyspace", action="store", type="string")
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  utils.set_options(options)
  env = TestEnv(options)
  if args[0] == 'setup':
    env.set_up()
    sys.stdout.write(json.dumps({
      "port": env.vtgate_port,
      }) + "\n")
    sys.stdout.flush()
  elif args[0] == 'teardown':
    env.shutdown()
Exemple #14
0
def parse_args():
    global options, args
    parser = optparse.OptionParser(usage='usage: %prog [options]')
    parser.add_option(
        '--shards',
        action='store',
        type='string',
        help="comma separated list of shard names, e.g: '-80,80-'")
    parser.add_option('--tablet-config',
                      action='store',
                      type='string',
                      help='json config for for non-master tablets. e.g '
                      "{'replica':2, 'rdonly':1}")
    parser.add_option('--keyspace', action='store', type='string')
    parser.add_option('--dbname-override', action='store', type='string')
    parser.add_option('--schema', action='store', type='string')
    parser.add_option('--vschema', action='store', type='string')
    parser.add_option('--vtgate-port', action='store', type='int')
    utils.add_options(parser)
    (options, args) = parser.parse_args()
    utils.set_options(options)
Exemple #15
0
def main():
    parser = optparse.OptionParser(usage="usage: %prog [options]")
    utils.add_options(parser)
    (options, args) = parser.parse_args()
    options.debug = True
    utils.set_options(options)
    env = keyspace_util.TestEnv()
    vtgate_server = None
    try:
        environment.topo_server().setup()
        env.launch(
            "user",
            shards=["-80", "80-"],
            ddls=[
                'create table user(user_id bigint, name varchar(128), primary key(user_id))',
                'create table user_extra(user_id bigint, extra varchar(128), primary key(user_id))',
                'create table music(user_id bigint, music_id bigint, primary key(user_id, music_id))',
                'create table music_extra(music_id bigint, keyspace_id bigint unsigned, primary key(music_id))',
            ],
        )
        env.launch(
            "lookup",
            ddls=[
                'create table user_idx(user_id bigint not null auto_increment, primary key(user_id))',
                'create table name_user_idx(name varchar(128), user_id bigint, primary key(name, user_id))',
                'create table music_user_idx(music_id bigint not null auto_increment, user_id bigint, primary key(music_id))',
            ],
        )
        utils.apply_vschema(vschema)
        vtgate_server, vtgate_port = utils.vtgate_start(cache_ttl='500s')
        utils.Vtctld().start()
        print "vtgate:", vtgate_port
        print "vtctld:", utils.vtctld.port
        utils.pause("the cluster is up, press enter to shut it down...")
    finally:
        utils.vtgate_kill(vtgate_server)
        env.teardown()
        utils.kill_sub_processes()
        utils.remove_tmp_files()
        environment.topo_server().teardown()
Exemple #16
0
def main():
  parser = optparse.OptionParser(usage="usage: %prog [options]")
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  options.debug = True
  utils.set_options(options)
  env = keyspace_util.TestEnv()
  vtgate_server=None
  try:
    environment.topo_server().setup()
    env.launch(
        "user",
        shards=["-80", "80-"],
        ddls=[
            'create table user(user_id bigint, name varchar(128), primary key(user_id))',
            'create table user_extra(user_id bigint, extra varchar(128), primary key(user_id))',
            'create table music(user_id bigint, music_id bigint, primary key(user_id, music_id))',
            'create table music_extra(music_id bigint, keyspace_id bigint unsigned, primary key(music_id))',
            ],
        )
    env.launch(
        "lookup",
        ddls=[
            'create table user_idx(user_id bigint not null auto_increment, primary key(user_id))',
            'create table name_user_idx(name varchar(128), user_id bigint, primary key(name, user_id))',
            'create table music_user_idx(music_id bigint not null auto_increment, user_id bigint, primary key(music_id))',
            ],
        )
    utils.apply_vschema(vschema)
    vtgate_server, vtgate_port = utils.vtgate_start(cache_ttl='500s')
    utils.Vtctld().start()
    print "vtgate:", vtgate_port
    print "vtctld:", utils.vtctld.port
    utils.pause("the cluster is up, press enter to shut it down...")
  finally:
    utils.vtgate_kill(vtgate_server)
    env.teardown()
    utils.kill_sub_processes()
    utils.remove_tmp_files()
    environment.topo_server().teardown()
def parse_args():
    global options, args
    parser = optparse.OptionParser(usage="usage: %prog [options]")
    parser.add_option(
        "--shards",
        action="store",
        type="string",
        help="comma separated list of shard names, e.g: '-80,80-'")
    parser.add_option(
        "--tablet-config",
        action="store",
        type="string",
        help=
        "json config for for non-master tablets. e.g {'replica':2, 'rdonly':1}"
    )
    parser.add_option("--keyspace", action="store", type="string")
    parser.add_option("--schema", action="store", type="string")
    parser.add_option("--vschema", action="store", type="string")
    parser.add_option("--vtgate-port", action="store", type="int")
    utils.add_options(parser)
    (options, args) = parser.parse_args()
    utils.set_options(options)
    parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
    parser.add_option("-m",
                      "--memcache",
                      action="store_true",
                      default=False,
                      help="starts a memcache d, and tests rowcache")
    parser.add_option(
        "-e",
        "--env",
        default='vttablet',
        help="Environment that will be used. Valid options: vttablet, vtocc")
    utils.add_options(parser)
    (options, args) = parser.parse_args()

    logging.getLogger().setLevel(logging.ERROR)
    utils.set_options(options)

    suite = unittest.TestSuite()
    if args:
        if args[0] == 'teardown':
            test_env.TestEnv(options.env).tearDown()
            exit(0)
        for arg in args:
            if hasattr(nocache_tests.TestNocache, arg):
                suite.addTest(nocache_tests.TestNocache(arg))
            elif hasattr(stream_tests.TestStream, arg):
                suite.addTest(stream_tests.TestStream(arg))
            elif hasattr(cache_tests.TestCache, arg) and options.memcache:
                suite.addTest(cache_tests.TestCache(arg))
            elif hasattr(cache_tests.TestWillNotBeCached,
                         arg) and options.memcache:
Exemple #19
0
from mysql_flavor import set_mysql_flavor
from protocols_flavor import set_protocols_flavor
from topo_flavor.server import set_topo_server_flavor


if __name__ == "__main__":
  parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
  parser.add_option("-m", "--memcache", action="store_true", default=False,
                    help="starts a memcache d, and tests rowcache")
  parser.add_option("-e", "--env", default='vttablet',
                    help="Environment that will be used. Valid options: vttablet, vtocc")
  utils.add_options(parser)
  (options, args) = parser.parse_args()

  logging.getLogger().setLevel(logging.ERROR)
  utils.set_options(options)

  suite = unittest.TestSuite()
  if args:
    if args[0] == 'teardown':
      test_env.TestEnv(options.env).tearDown()
      exit(0)
    for arg in args:
      if hasattr(nocache_tests.TestNocache, arg):
        suite.addTest(nocache_tests.TestNocache(arg))
      elif hasattr(stream_tests.TestStream, arg):
        suite.addTest(stream_tests.TestStream(arg))
      elif hasattr(cache_tests.TestCache, arg) and options.memcache:
        suite.addTest(cache_tests.TestCache(arg))
      elif hasattr(cache_tests.TestWillNotBeCached, arg) and options.memcache:
        suite.addTest(cache_tests.TestWillNotBeCached(arg))