当前位置: 首页>>代码示例>>Python>>正文


Python tarantool_server.TarantoolServer类代码示例

本文整理汇总了Python中lib.tarantool_server.TarantoolServer的典型用法代码示例。如果您正苦于以下问题:Python TarantoolServer类的具体用法?Python TarantoolServer怎么用?Python TarantoolServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TarantoolServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: module_init

def module_init():
    """ Called at import """
    args = Options().args
    # Change the current working directory to where all test
    # collections are supposed to reside
    # If script executed with (python test-run.py) dirname is ''
    # so we need to make it .
    path = os.path.dirname(sys.argv[0])
    if not path:
        path = '.'
    os.chdir(path)
    setenv()

    warn_unix_sockets_at_start(args.vardir)

    # always run with clean (non-existent) 'var' directory
    try:
        shutil.rmtree(args.vardir)
    except OSError:
        pass

    args.builddir = os.path.abspath(os.path.expanduser(args.builddir))

    SOURCEDIR = os.path.dirname(os.getcwd())
    BUILDDIR = args.builddir
    os.environ["SOURCEDIR"] = SOURCEDIR
    os.environ["BUILDDIR"] = BUILDDIR
    soext = sys.platform == 'darwin' and 'dylib' or 'so'
    os.environ["LUA_PATH"] = SOURCEDIR+"/?.lua;"+SOURCEDIR+"/?/init.lua;;"
    os.environ["LUA_CPATH"] = BUILDDIR+"/?."+soext+";;"

    TarantoolServer.find_exe(args.builddir)
    UnittestServer.find_exe(args.builddir)
开发者ID:tarantool,项目名称:test-run,代码行数:33,代码来源:__init__.py

示例2: main

def main():
    path = os.path.dirname(sys.argv[0])
    if not path:
        path = '.'
    os.chdir(path)
    if '--prepare' in sys.argv:
        prepare_env()
        exit(0)
    srv = None
    srv = TarantoolServer()
    srv.script = 'test/shared/box.lua'
    srv.start()
    test_dir_path = os.path.abspath(os.path.join(os.getcwd(), 'test'))
    test_cwd = os.path.dirname(srv.vardir)
    test_lib_path = ""
    try:
        shutil.copy('test/shared/phpunit.xml', test_cwd)
        cmd = ''
        test_lib_path = os.path.join(test_dir_path, 'phpunit.phar')
        shutil.copy('test/shared/tarantool.ini', test_cwd)
        shutil.copy('modules/tarantool.so', test_cwd)
        if '--flags' in sys.argv:
            os.environ['ZEND_DONT_UNLOAD_MODULES'] = '1'
            os.environ['USE_ZEND_ALLOC'] = '0'
            os.environ['MALLOC_CHECK_'] = '1'
        if '--valgrind' in sys.argv:
            cmd = cmd + 'valgrind --leak-check=full --log-file=php.out '
            cmd = cmd + '--suppressions=test/shared/valgrind.sup '
            cmd = cmd + '--keep-stacktraces=alloc-and-free --freelist-vol=2000000000 '
            cmd = cmd + '--malloc-fill=0 --free-fill=0 '
            cmd = cmd + '--num-callers=50 ' + find_php_bin()
            cmd = cmd + ' -c tarantool.ini {0}'.format(test_lib_path)
        elif '--gdb' in sys.argv:
            cmd = cmd + 'gdb {0} --ex '.format(find_php_bin())
            cmd = cmd + '"set args -c tarantool.ini {0}"'.format(test_lib_path)
        elif '--strace' in sys.argv:
            cmd = cmd + 'strace ' + find_php_bin()
            cmd = cmd + ' -c tarantool.ini {0}'.format(test_lib_path)
        else:
            print find_php_bin()
            cmd = '{0} -c tarantool.ini {1}'.format(find_php_bin(), test_lib_path)
            print cmd

        print('Running ' + repr(cmd))
        version = read_popen('php-config --version').strip(' \n\t') + '.'
        version1 = read_popen('php-config --extension-dir').strip(' \n\t')
        version += '\n' + ('With' if version1.find('non-zts') == -1 else 'Without') + ' ZTS'
        version += '\n' + ('With' if version1.find('no-debug') == -1 else 'Without') + ' Debug'
        print('Running against ' + version)
        proc = subprocess.Popen(cmd, shell=True, cwd=test_cwd)
        proc.wait()
    finally:
        a = [
                os.path.join(test_cwd, 'tarantool.ini'),
                os.path.join(test_cwd, 'phpunit.xml'),
                os.path.join(test_cwd, 'tarantool.so'),
        ]
        for elem in a:
            if os.path.exists(elem):
                os.remove(elem)
开发者ID:negram,项目名称:tarantool-php,代码行数:60,代码来源:test-run.py

示例3: find_tests

    def find_tests(self):
        if self.ini['core'] == 'tarantool':
            TarantoolServer.find_tests(self, self.suite_path)
        elif self.ini['core'] == 'app':
            AppServer.find_tests(self, self.suite_path)
        elif self.ini['core'] == 'unittest':
            UnittestServer.find_tests(self, self.suite_path)
        elif self.ini['core'] == 'stress':
            # parallel tests are not supported and disabled for now
            return []
        else:
            raise ValueError('Cannot collect tests of unknown type')

        if not lib.Options().args.reproduce:
            color_stdout("Collecting tests in ", schema='ts_text')
            color_stdout(
                '%s (Found %s tests)' % (
                    repr(self.suite_path).ljust(16),
                    str(len(self.tests)).ljust(3)
                ),
                schema='path'
            )
            color_stdout(": ", self.ini["description"], ".\n",
                         schema='ts_text')
        return self.tests
开发者ID:tarantool,项目名称:test-run,代码行数:25,代码来源:test_suite.py

示例4: main

def main():
    options = Options()
    oldcwd = os.getcwd()
    # Change the current working directory to where all test
    # collections are supposed to reside
    # If script executed with (python test-run.py) dirname is ''
    # so we need to make it .
    path = os.path.dirname(sys.argv[0])
    if not path:
        path = '.'
    os.chdir(path)
    setenv()

    failed_tests = []

    try:
        color_stdout("Started {}\n".format(" ".join(sys.argv)), schema='tr_text')
        suite_names = []
        if options.args.suites != []:
            suite_names = options.args.suites
        else:
            for root, dirs, names in os.walk(os.getcwd()):
                if "suite.ini" in names:
                    suite_names.append(os.path.basename(root))

        suites = [TestSuite(suite_name, options.args) for suite_name in sorted(suite_names)]

        TarantoolServer.find_exe(options.args.builddir)
        UnittestServer.find_exe(options.args.builddir)
        

        for suite in suites:
            failed_tests.extend(suite.run_all())
    except RuntimeError as e:
        color_stdout("\nFatal error: {0}. Execution aborted.\n".format(e), schema='error')
        if options.args.gdb:
            time.sleep(100)
        return (-1)
    finally:
        os.chdir(oldcwd)

    if failed_tests and options.args.is_force:
        color_stdout("\n===== {0} tests failed:".format(len(failed_tests))+"\n", schema='error')
        for test in failed_tests:
             color_stdout("----- "+test+"\n", schema='info')

    return (-1 if failed_tests else 0)
开发者ID:Spikhalskiy,项目名称:tarantool,代码行数:47,代码来源:test-run.py

示例5: setUpClass

 def setUpClass(self):
     print(' SCHEMA '.center(70, '='))
     print('-' * 70)
     self.srv = TarantoolServer()
     self.srv.script = 'tests/suites/box.lua'
     self.srv.start()
     self.con = tarantool.Connection('localhost', self.srv.args['primary'])
     self.sch = self.con.schema
开发者ID:mkaplenko,项目名称:tarantool-python,代码行数:8,代码来源:test_schema.py

示例6: setUpClass

 def setUpClass(self):
     print " SCHEMA ".center(70, "=")
     print "-" * 70
     self.srv = TarantoolServer()
     self.srv.script = "tests/suites/box.lua"
     self.srv.start()
     self.con = tarantool.Connection("localhost", self.srv.args["primary"])
     self.sch = self.con.schema
开发者ID:valerylisay,项目名称:tarantool-python,代码行数:8,代码来源:test_schema.py

示例7: main

def main():
    path = os.path.dirname(sys.argv[0])
    if not path:
        path = '.'
    os.chdir(path)
    srv = None
    srv = TarantoolServer()
    srv.script = 'tests/shared/box.lua'
    srv.start()
    test_dir_path = os.path.abspath(os.path.join(os.getcwd(), 'tests'))
    test_cwd = os.path.dirname(srv.vardir)
    test_lib_path = ""
    try:
        shutil.copy('tests/shared/phpunit.xml', test_cwd)
        if 'global' in sys.argv:
            cmd = 'phpunit -v'
        else:
            test_lib_path = os.path.join(test_dir_path, 'phpunit.phar')
            shutil.copy('tests/shared/php.ini', test_cwd)
            shutil.copy('modules/tarantool.so', test_cwd)
            os.environ['PATH'] += os.pathsep + test_dir_path
            cmd = 'php -c php.ini {0}'.format(test_lib_path)
        print('Running ' + repr(cmd))
        version = read_popen('php-config --version').strip(' \n\t') + '.'
        version1 = read_popen('php-config --extension-dir').strip(' \n\t')
        version += ' ' + ('With' if version1.find('non-zts') == -1 else 'Without') + ' ZTS'
        version += ' ' + ('With' if version1.find('no-debug') == -1 else 'Without') + ' Debug'
        print('Running against ' + version)
        proc = subprocess.Popen(cmd, shell=True, cwd=test_cwd)
        cmd_stat = proc.wait()
        if (cmd_stat in [245, 139] and 'global' not in sys.argv):
            proc = subprocess.Popen(build_gdb_cmd(test_lib_path), shell=True, cwd=test_cwd)
    finally:
        del srv
        a = [
                os.path.join(test_cwd, 'php.ini'),
                os.path.join(test_cwd, 'phpunit.xml'),
                os.path.join(test_cwd, 'tarantool.so'),
        ]
        for elem in a:
            if os.path.exists(elem):
                os.remove(elem)
开发者ID:Anei,项目名称:tarantool-php,代码行数:42,代码来源:test-run.py

示例8: run_test

def run_test(name, unix = False):
    retval = True

    try:
        srv = TarantoolServer(unix = unix)
        srv.script = 'shared/box.lua'
        srv.start()
        test_cwd = os.path.dirname(srv.vardir)
        cmd = compile_cmd(name)
        print('Running ' + repr(cmd))
        proc = subprocess.Popen(cmd, shell=True, cwd=test_cwd)
        if (proc.wait() != 0):
            retval = False
    except Exception as e:
        print e
        pass
    finally:
        pass

    return retval
开发者ID:thekvs,项目名称:tarantoolr,代码行数:20,代码来源:test-run.py

示例9: setUpClass

 def setUpClass(self):
     print ' DML '.center(70, '=')
     print '-' * 70
     self.srv = TarantoolServer()
     self.srv.script = 'tests/suites/box.lua'
     self.srv.start()
     self.con = tarantool.Connection('localhost', self.srv.args['primary'])
     self.adm = self.srv.admin
     self.space_created = self.adm("box.schema.create_space('space_1')")
     self.adm("box.space['space_1']:create_index('primary', {type = 'tree', parts = {1, 'num'}, unique = true})")
     self.adm("box.space['space_1']:create_index('secondary', {type = 'tree', parts = {2, 'num', 3, 'str'}, unique = true})")
     self.adm("json = require('json')")
     self.adm("fiber = require('fiber')")
     self.adm("uuid = require('uuid')")
开发者ID:ko91h,项目名称:tarantool-python,代码行数:14,代码来源:test_dml.py

示例10: main

def main():
    path = os.path.dirname(sys.argv[0])
    if not path:
        path = '.'
    os.chdir(path)
    retval = True
    try:
        srv = TarantoolServer()
        srv.script = 'shared/box.lua'
        srv.start()
        test_cwd = os.path.dirname(srv.vardir)
        cmd = compile_cmd('tarantool-tcp')
        print('Running ' + repr(cmd))
        proc = subprocess.Popen(cmd, shell=True, cwd=test_cwd)
        if (proc.wait() != 0):
            retval = False
    except Exception as e:
        print e
        pass
    finally:
        pass

    try:
        srv = TarantoolServer(unix = True)
        srv.script = 'shared/box.lua'
        srv.start()
        test_cwd = os.path.dirname(srv.vardir)
        cmd = compile_cmd('tarantool-unix')
        print('Running ' + repr(cmd))
        proc = subprocess.Popen(cmd, shell=True, cwd=test_cwd)
        proc.wait()
        if (proc.wait() != 0):
            retval = False
    except Exception as e:
        print e
        pass
    finally:
        pass

    if (retval):
        print "Everything is OK"
    else:
        print "FAILED"

    return (-1 if not retval else 0)
开发者ID:zloidemon,项目名称:tarantool-c,代码行数:45,代码来源:test-run.py

示例11: __init__

    def __init__(self, suite_path, args):
        self.args = args
        self.tests = []
        self.suite_path = suite_path
        self.ini = {
                'core': 'tarantool',
                'script': os.path.join(suite_path, 'parallel.lua'),
        }

        # read suite config
        config = ConfigParser.ConfigParser()
        config.read(os.path.join(suite_path, "suite.ini"))
        self.ini.update(dict(config.items("default")))
        self.ini.update(self.args.__dict__)
        self.jobs = int(self.ini.get('jobs', 1))
        self.count = int(self.ini.get('count', 0))

        for i in ["script"]:
            self.ini[i] = os.path.join(suite_path, self.ini[i]) if i in self.ini else None
        self.server = TarantoolServer(self.ini)
        self.pool = None
        self.iterator = None
开发者ID:mingodad,项目名称:tarantool,代码行数:22,代码来源:parallel.py

示例12: TarantoolServer

# Cleanup
server.stop()
server.script = script
server.deploy()

print '-------------------------------------------------------------'
print 'gh-527: update vclock on delete from box.space._cluster'
print '-------------------------------------------------------------'

# master server
master = server
master_id = master.get_param('server')['id']

master.admin("box.schema.user.grant('guest', 'replication')")

replica = TarantoolServer(server.ini)
replica.script = 'replication/replica.lua'
replica.vardir = server.vardir
replica.rpl_master = master
replica.deploy()
replica.wait_lsn(master_id, master.get_lsn(master_id))
replica_id = replica.get_param('server')['id']
replica_uuid = replica.get_param('server')['uuid']
sys.stdout.push_filter(replica_uuid, '<replica uuid>')
replica.admin('box.space._schema:insert{"test", 48}')

replica.admin('box.info.server.id')
replica.admin('box.info.server.ro')
replica.admin('box.info.server.lsn') # 1
replica.admin('box.info.vclock[%d]' % replica_id)
开发者ID:DarkDare,项目名称:tarantool,代码行数:30,代码来源:cluster.test.py

示例13: TarantoolServer

import sys
import time
import yaml

from lib.memcached_connection import MemcachedConnection
from lib.tarantool_server import TarantoolServer

sonet = """The expense of spirit
in a waste of shame
Is lust in action;
and till action, lust""".split('\n')

master = server
master_memcached = master.memcached

replica = TarantoolServer()
replica.deploy("replication/cfg/replica.cfg",
           replica.find_exe(self.args.builddir),
           os.path.join(self.args.vardir, "replica"))
replica_memcached = replica.memcached

###################################
def get_lsn(serv):
    serv_admin = serv.admin
    resp = serv_admin("box.info.lsn", silent=True)
    return yaml.load(resp)[0]

def wait(serv_master = master, serv_replica = replica):
    lsn = get_lsn(serv_master)
    serv_replica.wait_lsn(lsn)
    return lsn
开发者ID:catcher22,项目名称:tarantool,代码行数:31,代码来源:memcached.test.py

示例14: TarantoolServer

import os
import sys
import re
import yaml
from lib.tarantool_server import TarantoolServer

server = TarantoolServer(server.ini)
server.script = 'long_run/lua/finalizers.lua'
server.vardir = os.path.join(server.vardir, 'finalizers')
try:
    server.deploy()
except:
    print "Expected error:", sys.exc_info()[0]
else:
    print "Error! exception did not occur"


开发者ID:DarkDare,项目名称:tarantool,代码行数:15,代码来源:finalizers.test.py

示例15: require

# master server
master = server
master.admin("fiber = require('fiber')")
master.admin("box.schema.user.grant('guest', 'replication')")
master.admin("box.schema.user.grant('guest', 'execute', 'universe')")

print '----------------------------------------------------------------------'
print 'Bootstrap replicas'
print '----------------------------------------------------------------------'

# Start replicas
master.id = master.get_param('server')['id']
master_lsn = master.get_lsn(master.id)
cluster = [ master ]
for i in range(REPLICA_N - 1):
    server = TarantoolServer(server.ini)
    server.script = 'replication/replica.lua'
    server.vardir = os.path.join(server.vardir, 'replica', str(master.id + i))
    server.rpl_master = master
    server.deploy()
    # Wait replica to fully bootstrap.
    # Otherwise can get ACCESS_DENIED error.
    server.wait_lsn(master.id, master_lsn)
    cluster.append(server)

# Make a list of servers
sources = []
for server in cluster:
    sources.append(yaml.load(server.admin('box.cfg.listen', silent = True))[0])
    server.id = server.get_param('server')['id']
开发者ID:daurnimator,项目名称:tarantool,代码行数:30,代码来源:multi.test.py


注:本文中的lib.tarantool_server.TarantoolServer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。