def servers(request): servers = [{ 'backends': make_backends(backends_count=1, group_id=g) } for g in 1, 2] _servers = Servers(servers=servers, isolated=True, path='isolated_servers') yield _servers _servers.stop()
def servers(request): groups = [int(g) for g in request.config.option.groups.split(',')] _servers = Servers(without_cocaine=True, servers=make_servers(groups, nodes_count=2, backends_count=1), isolated=True, path='special_servers') yield _servers _servers.stop()
def servers(request): groups = [int(g) for g in request.config.option.groups.split(',')] _servers = Servers(servers=make_servers(groups, nodes_count=2, backends_count=1), isolated=True, path='special_servers') yield _servers _servers.stop()
def server(request): groups = [int(g) for g in request.config.option.groups.split(',')] servers = Servers(groups=groups, without_cocaine=request.config.option.without_cocaine, nodes_count=int(request.config.option.nodes_count), backends_count=int(request.config.option.backends_count)) request.config.option.remotes = servers.remotes request.config.option.monitors = servers.monitors yield servers servers.stop()
def servers(request): ''' Creates elliptics server nodes to work against. Returns node ensemble configuration. ''' groups = [int(g) for g in request.config.option.groups.split(',')] _servers = Servers(servers=make_servers(groups, int(request.config.option.nodes_count), int(request.config.option.backends_count))) request.config.option.remotes = _servers.remotes request.config.option.monitors = _servers.monitors yield _servers _servers.stop()
def servers(request): ''' Creates elliptics server nodes to work against. Returns node ensemble configuration. ''' groups = [int(g) for g in request.config.option.groups.split(',')] _servers = Servers(without_cocaine=request.config.option.without_cocaine, servers=make_servers(groups, int(request.config.option.nodes_count), int(request.config.option.backends_count))) request.config.option.remotes = _servers.remotes request.config.option.monitors = _servers.monitors yield _servers _servers.stop()
def run_server(group_id, records_in_blob, path, datasort_dir=None, single_pass_threshold=None): """Run server under contextmanager, so it will be killed at exit. Server will be run with one backend in @group, all other parameters will be placed into config Args: group_id(int): id of the group which should be served by the backend records_in_blob(int): limit for a blob in the backend path(str or None): where backend should store its blobs (if None use default provided by test env) datasort_dir(str or None): where backend should store temporary chunks during defrag (if None use temporary directory at @path) Yields: Servers: configured server with one backend and specified paramters. """ config = [{ 'backends': [{ 'group': group_id, 'records_in_blob': records_in_blob, 'periodic_timeout': 1, }] }] # set datasort_dir only if it is provided if datasort_dir is not None: config[0]['backends'][0]['datasort_dir'] = datasort_dir if single_pass_threshold is not None: config[0]['backends'][0][ 'single_pass_file_size_threshold'] = single_pass_threshold server = Servers(servers=config, path=path) try: yield server finally: server.stop()