#!/usr/bin/env python import gevent.monkey; gevent.monkey.patch_all() import functools import logging import os import subprocess import sys import unittest from argparse import ArgumentParser from kronos.conf import settings from tests.conf import default_settings settings.update(default_settings) # Disable log handlers. import kronos.app # noqa logging.root.handlers[:] = [] logging.root.addHandler(logging.NullHandler()) # Mapping from test name => (<pathname of directory with test file>, # <backends to run test against>) TESTS = { 'cassandra': ('tests/storage/cassandra', ('cassandra', )), 'common': ('tests/common', ('memory', 'cassandra', 'elasticsearch',)), 'conf': ('tests/conf', ('memory', )),
#!/usr/bin/python import gevent.monkey; gevent.monkey.patch_all() import functools import logging import os import subprocess import sys import unittest from argparse import ArgumentParser from kronos.conf import settings from tests.conf import default_settings settings.update(default_settings) # Disable log handlers. import kronos.app # noqa logging.root.handlers[:] = [] logging.root.addHandler(logging.NullHandler()) # Mapping from test name => (<pathname of directory with test file>, # <backends to run test against>) TESTS = { 'cassandra': ('tests/storage/cassandra', ('cassandra', )), 'common': ('tests/common', ('memory', 'cassandra', 'elasticsearch',)), 'conf': ('tests/conf', ('memory', )),
parser.add_argument('--port', action='store', default='8150', help='port to listen for incoming requests') parser.add_argument('--serving-mode', choices=[ServingMode.ALL, ServingMode.COLLECTOR, ServingMode.READONLY], help='which serving mode to run in') parser.add_argument('--config', action='store', help='path of config file to use') parser.add_argument('--profile', action='store_true', help='Profile each request using cProfile?') args = parser.parse_args() settings.clear() if args.config: # If a config file path is given, import that as the `settings` module. settings.update(imp.load_source('kronos.conf.run_settings', args.config)) else: # Otherwise use default settings. This is to ensure we never try to read # the settings for the configured kronos service when using this runner # script. from kronos.conf import default_settings settings.update(default_settings) # Override the `debug` in the settings module and `debug` for # `args`. settings.debug = args.debug or settings.debug settings.serving_mode = args.serving_mode or settings.serving_mode settings.profile = args.profile or settings.profile # Only load the application after we've overwritten settings.serving_mode, or # else the endpoint access control logic will kick in too early.