Example #1
0
def validate_and_serialize_options(docopt_options):
    """
    For each value that should be configured for a config object, attempt to
    serialize the passed-in strings into objects that can be used for
    configuration. If no values were passed in, use the list of options from
    the defaults above.

    Raises a ValueError and prints an error message if any values are invalid
    or didn't serialize correctly.
    """
    vnodes = _validate_and_serialize_vnodes(docopt_options['--vnodes'])
    if vnodes.error_messages:
        raise ValueError('Validation error:\n{}'.format('\t\n'.join(
            list(vnodes.error_messages))))
    return GlobalConfigObject(
        vnodes=vnodes.serialized or default_config_matrix.vnodes)
Example #2
0
OFFHEAP_MEMTABLES = os.environ.get('OFFHEAP_MEMTABLES',
                                   '').lower() in ('yes', 'true')
NUM_TOKENS = os.environ.get('NUM_TOKENS', '256')
RECORD_COVERAGE = os.environ.get('RECORD_COVERAGE',
                                 '').lower() in ('yes', 'true')
REUSE_CLUSTER = os.environ.get('REUSE_CLUSTER', '').lower() in ('yes', 'true')
SILENCE_DRIVER_ON_SHUTDOWN = os.environ.get('SILENCE_DRIVER_ON_SHUTDOWN',
                                            'true').lower() in ('yes', 'true')
IGNORE_REQUIRE = os.environ.get('IGNORE_REQUIRE',
                                '').lower() in ('yes', 'true')
DATADIR_COUNT = os.environ.get('DATADIR_COUNT', '3')
ENABLE_ACTIVE_LOG_WATCHING = os.environ.get('ENABLE_ACTIVE_LOG_WATCHING',
                                            '').lower() in ('yes', 'true')

# devault values for configuration from configuration plugin
_default_config = GlobalConfigObject(vnodes=True, )

if CONFIG is None:
    CONFIG = _default_config

DISABLE_VNODES = not CONFIG.vnodes

if os.environ.get('DISABLE_VNODES', '').lower() in ('yes', 'true'):
    print 'DISABLE_VNODES environment variable deprecated. Use `./run_dtests.py --vnodes false` instead.'

CURRENT_TEST = ""

logging.basicConfig(
    filename=os.path.join(LOG_SAVED_DIR, "dtest.log"),
    filemode='w',
    format=
Example #3
0
"""
from __future__ import print_function

import subprocess
from collections import namedtuple
from itertools import product
from os import getcwd
from tempfile import NamedTemporaryFile

from docopt import docopt

from plugins.dtestconfig import GlobalConfigObject

# Generate values in a matrix from these lists of values for each attribute
# not defined in arguments to the runner script.
default_config_matrix = GlobalConfigObject(vnodes=(True, False), )


def _noop(*args, **kwargs):
    pass


class ValidationResult(
        namedtuple('_ValidationResult', ['serialized', 'error_messages'])):
    """
    A value to be returned from validation functions. If serialization works,
    return one with 'serialized' set, otherwise return a list of string on the
    'error_messages' attribute.
    """
    __slots__ = ()