Beispiel #1
0
    def setUpClass(cls):
        """Set up two keyspaces: one unsharded, one with two shards."""
        topology = vttest_pb2.VTTestTopology()
        topology.cells.append("test")
        topology.cells.append("test2")
        keyspace = topology.keyspaces.add(name="test_keyspace")
        keyspace.replica_count = 2
        keyspace.rdonly_count = 2
        keyspace.shards.add(name="-80")
        keyspace.shards.add(name="80-")
        keyspace2 = topology.keyspaces.add(name="test_keyspace2")
        keyspace2.shards.add(name="0")
        keyspace2.replica_count = 2
        keyspace2.rdonly_count = 1

        if os.environ.get("CI") == "true" and os.environ.get("TRAVIS") == "true":
            username = os.environ["SAUCE_USERNAME"]
            access_key = os.environ["SAUCE_ACCESS_KEY"]
            capabilities = {}
            capabilities["tunnel-identifier"] = os.environ["TRAVIS_JOB_NUMBER"]
            capabilities["build"] = os.environ["TRAVIS_BUILD_NUMBER"]
            capabilities["platform"] = "Linux"
            capabilities["browserName"] = "chrome"
            hub_url = "%s:%s@localhost:4445" % (username, access_key)
            cls.driver = webdriver.Remote(
                desired_capabilities=capabilities, command_executor="http://%s/wd/hub" % hub_url
            )
        else:
            os.environ["webdriver.chrome.driver"] = os.path.join(environment.vtroot, "dist")
            # Only testing against Chrome for now
            cls.driver = webdriver.Chrome()
            cls.driver.set_window_position(0, 0)
            cls.driver.set_window_size(1920, 1280)

        port = environment.reserve_ports(1)
        vttest_environment.base_port = port
        mysql_flavor.set_mysql_flavor(None)

        cls.db = local_database.LocalDatabase(
            topology,
            os.path.join(environment.vttop, "test/vttest_schema"),
            False,
            None,
            web_dir=os.path.join(environment.vttop, "web/vtctld"),
            default_schema_dir=os.path.join(environment.vttop, "test/vttest_schema/default"),
            web_dir2=os.path.join(environment.vttop, "web/vtctld2/app"),
        )
        cls.db.setup()
        cls.vtctld_addr = "http://localhost:%d" % cls.db.config()["port"]
        utils.pause(
            "Paused test after vtcombo was started.\n" "For manual testing, connect to vtctld: %s" % cls.vtctld_addr
        )
Beispiel #2
0
  def setUpClass(cls):
    """Set up two keyspaces: one unsharded, one with two shards."""
    if os.environ.get('CI') == 'true' and os.environ.get('TRAVIS') == 'true':
      username = os.environ['SAUCE_USERNAME']
      access_key = os.environ['SAUCE_ACCESS_KEY']
      capabilities = {}
      capabilities['tunnel-identifier'] = os.environ['TRAVIS_JOB_NUMBER']
      capabilities['build'] = os.environ['TRAVIS_BUILD_NUMBER']
      capabilities['platform'] = 'Linux'
      capabilities['browserName'] = 'chrome'
      hub_url = '%s:%s@localhost:4445' % (username, access_key)
      cls.driver = webdriver.Remote(
          desired_capabilities=capabilities,
          command_executor='http://%s/wd/hub' % hub_url)
    else:
      os.environ['webdriver.chrome.driver'] = os.path.join(
          os.environ['VTROOT'], 'dist')
      # Only testing against Chrome for now
      cls.driver = webdriver.Chrome()

    topology = vttest_pb2.VTTestTopology()
    topology.cells.append('test')
    keyspace = topology.keyspaces.add(name='test_keyspace')
    keyspace.replica_count = 2
    keyspace.rdonly_count = 2
    keyspace.shards.add(name='-80')
    keyspace.shards.add(name='80-')
    keyspace2 = topology.keyspaces.add(name='test_keyspace2')
    keyspace2.shards.add(name='0')
    keyspace2.replica_count = 2
    keyspace2.rdonly_count = 1

    port = environment.reserve_ports(1)
    vttest_environment.base_port = port
    mysql_flavor.set_mysql_flavor(None)

    cls.db = local_database.LocalDatabase(
        topology, '', False, None,
        os.path.join(os.environ['VTTOP'], 'web/vtctld2/dist'),
        os.path.join(os.environ['VTTOP'], 'test/vttest_schema/default'))
    cls.db.setup()
    cls.vtctld_addr = 'http://localhost:%d' % cls.db.config()['port']
    utils.pause('Paused test after vtcombo was started.\n'
                'For manual testing, connect to vtctld: %s' % cls.vtctld_addr)
      '--web_dir2',
      help='location of the vtctld2 web server files.')
  parser.add_option(
      '-f', '--extra_my_cnf',
      help='extra files to add to the config, separated by ":"')
  parser.add_option(
      '-v', '--verbose', action='store_true',
      help='Display extra error messages.')
  parser.add_option('-c', '--cells', default='test',
                    help='Comma separated list of cells')
  parser.add_option('-k', '--keyspaces', default='test_keyspace',
                    help='Comma separated list of keyspaces')
  parser.add_option('--num_shards', default='2',
                    help='Comma separated shard count (one per keyspace)')
  parser.add_option('--replica_count', type='int', default=2,
                    help='Replica tablets per shard (includes master)')
  parser.add_option('--rdonly_count', type='int', default=1,
                    help='Rdonly tablets per shard')
  parser.add_option('--charset', default='utf8', help='MySQL charset')
  parser.add_option(
      '--snapshot_file', default=None, help='A MySQL DB snapshot file')
  (options, args) = parser.parse_args()
  if options.verbose:
    logging.getLogger().setLevel(logging.DEBUG)

  # This will set the flavor based on the MYSQL_FLAVOR env var,
  # or default to MariaDB.
  mysql_flavor.set_mysql_flavor(None)

  main(options)
Beispiel #4
0
def reset_mysql_flavor():
  mysql_flavor.set_mysql_flavor(None)
Beispiel #5
0
        '--max_table_shard_size',
        type='int',
        default=10000,
        help='The maximum number of initial rows in a table shard. Ignored if'
        '--initialize_with_random_data is false. The actual number is chosen'
        ' randomly')
    parser.add_option(
        '-n',
        '--null_probability',
        type='float',
        default=0.1,
        help='The probability to initialize a field with "NULL" '
        ' if --initialize_with_random_data is true. Only applies to fields'
        ' that can contain NULL values.')
    parser.add_option('-w',
                      '--web_dir',
                      help='location of the vtctld web server files.')
    parser.add_option('-v',
                      '--verbose',
                      action='store_true',
                      help='Display extra error messages.')
    (options, args) = parser.parse_args()
    if options.verbose:
        logging.getLogger().setLevel(logging.DEBUG)

    # This will set the flavor based on the MYSQL_FLAVOR env var,
    # or default to MariaDB.
    mysql_flavor.set_mysql_flavor(None)

    main(options)
Beispiel #6
0
def reset_mysql_flavor():
    mysql_flavor.set_mysql_flavor(None)