Пример #1
0
#!/usr/bin/env python
# Copyright 2014-2015 RethinkDB, all rights reserved.

"""The `interface.db_config` test checks that the special `rethinkdb.db_config` table behaves as expected."""

import os, sys

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse

r = utils.import_python_driver()

op = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(op)
_, command_prefix, serve_options = scenario_common.parse_mode_flags(op.parse(sys.argv))

utils.print_with_time("Starting server")
with driver.Process(name='./a', command_prefix=command_prefix, extra_options=serve_options, wait_until_ready=True) as server:
    
    utils.print_with_time("Establishing ReQL connection")
    conn = r.connect(host=server.host, port=server.driver_port)
    
    utils.print_with_time("Starting tests")
    res = list(r.db("rethinkdb").table("db_config").run(conn))
    assert res == [], res
    res = r.db_create("foo").run(conn)
    assert res["dbs_created"] == 1
    assert len(res["config_changes"]) == 1
    assert res["config_changes"][0]["old_val"] is None
    assert res["config_changes"][0]["new_val"] == r.db("foo").config().run(conn)
Пример #2
0
import bisect, os, random, resource, string, sys, time, threading

sys.path.append(
    os.path.abspath(
        os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse

try:
    xrange
except NameError:
    xrange = range

# Don't allow someone to run this without unlimited size core files - which are really useful for debugging
assert resource.getrlimit(resource.RLIMIT_CORE)[0] == resource.RLIM_INFINITY

opts = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(opts)
opts['random-seed'] = vcoptparse.FloatFlag('--random-seed', random.random())
opts['servers'] = vcoptparse.IntFlag('--servers',
                                     1)  # Number of servers in the cluster
opts['duration'] = vcoptparse.IntFlag(
    '--duration', 900)  # Time to perform fuzzing in seconds
opts['progress'] = vcoptparse.BoolFlag(
    '--progress',
    False)  # Write messages every 10 seconds with the time remaining
opts['threads'] = vcoptparse.IntFlag(
    '--threads',
    16)  # Number of client threads to run (not counting changefeeds)
opts['changefeeds'] = vcoptparse.BoolFlag(
    '--changefeeds', False)  # Whether or not to use changefeeds
opts['kill'] = vcoptparse.BoolFlag(
Пример #3
0
def option_parser_for_connect():
    op = vcoptparse.OptParser()
    op['address'] = vcoptparse.StringFlag('--address', 'localhost:28015')
    op['table'] = vcoptparse.StringFlag('--table')
    return op