cleaning up, improvements, etc
This commit is contained in:
parent
1b95251de5
commit
82a873222b
|
@ -60,6 +60,11 @@ def installapp():
|
|||
testdeps()
|
||||
|
||||
|
||||
def testall():
|
||||
unit()
|
||||
integration()
|
||||
|
||||
|
||||
def integration():
|
||||
local('nosetests fuel_plugin/tests/functional/tests.py:AdapterTests -v')
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
class NoseDriver(object):
|
||||
def __init__(self):
|
||||
LOG.warning('WTF')
|
||||
LOG.warning('Initializing Nose Driver')
|
||||
self._named_threads = {}
|
||||
session = engine.get_session()
|
||||
with session.begin(subtransactions=True):
|
||||
|
@ -37,10 +37,6 @@ class NoseDriver(object):
|
|||
return unique_id in self._named_threads
|
||||
|
||||
def run(self, test_run, test_set, tests=None):
|
||||
"""
|
||||
remove unneceserry arguments
|
||||
spawn processes and send them tasks as to workers
|
||||
"""
|
||||
tests = tests or test_run.enabled_tests
|
||||
if tests:
|
||||
argv_add = [nose_utils.modify_test_name_for_nose(test) for test in
|
||||
|
@ -61,7 +57,7 @@ class NoseDriver(object):
|
|||
argv=['ostf_tests'] + argv_add)
|
||||
self._named_threads.pop(int(test_run_id), None)
|
||||
except Exception, e:
|
||||
LOG.exception('Test run: %s\n', test_run_id)
|
||||
LOG.exception('Test run ID: %s', test_run_id)
|
||||
finally:
|
||||
models.TestRun.update_test_run(
|
||||
session, test_run_id, status='finished')
|
||||
|
@ -86,19 +82,20 @@ class NoseDriver(object):
|
|||
return True
|
||||
return False
|
||||
|
||||
def _clean_up(self, test_run_id, external_id, cleanup):
|
||||
def _clean_up(self, test_run_id, cluster_id, cleanup):
|
||||
session = engine.get_session()
|
||||
try:
|
||||
module_obj = __import__(cleanup, -1)
|
||||
|
||||
os.environ['NAILGUN_HOST'] = str(conf.nailgun.host)
|
||||
os.environ['NAILGUN_PORT'] = str(conf.nailgun.port)
|
||||
os.environ['CLUSTER_ID'] = str(external_id)
|
||||
os.environ['CLUSTER_ID'] = str(cluster_id)
|
||||
|
||||
module_obj.cleanup.cleanup()
|
||||
|
||||
except Exception:
|
||||
LOG.exception('EXCEPTION IN CLEANUP')
|
||||
LOG.exception('Cleanup errer. Test Run ID %s. Cluster ID %s',
|
||||
test_run_id, cluser_id)
|
||||
|
||||
finally:
|
||||
models.TestRun.update_test_run(
|
||||
|
|
|
@ -76,12 +76,9 @@ class DiscoveryPlugin(plugins.Plugin):
|
|||
session.add(test_obj)
|
||||
|
||||
|
||||
def discovery(path=None):
|
||||
def discovery(path=CORE_PATH):
|
||||
"""Will discover all tests on provided path and save info in db
|
||||
"""
|
||||
function to automaticly discover any test packages
|
||||
"""
|
||||
|
||||
tests = path if path else CORE_PATH
|
||||
LOG.info('Starting discovery for %r.', tests)
|
||||
nose_test_runner.SilentTestProgram(
|
||||
addplugins=[DiscoveryPlugin()],
|
||||
|
|
|
@ -31,7 +31,7 @@ PECAN_DEFAULT = {
|
|||
},
|
||||
'dbpath': 'postgresql+psycopg2://ostf:ostf@localhost/ostf',
|
||||
'debug': False,
|
||||
'debug_tests': 'functional/dummy_tests'
|
||||
'debug_tests': 'fuel_plugin/tests/functional/dummy_tests'
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ def setup_config(pecan_config):
|
|||
|
||||
def setup_app(config=None):
|
||||
setup_config(config or {})
|
||||
app_hooks = [hooks.SessionHook()]
|
||||
app_hooks = [hooks.SessionHook(), hooks.ExceptionHandling()]
|
||||
app = pecan.make_app(
|
||||
pecan.conf.app.root,
|
||||
debug=pecan.conf.debug,
|
||||
|
|
|
@ -23,30 +23,9 @@ from fuel_plugin.ostf_adapter.storage import engine
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ExceptionHandlingHook(hooks.PecanHook):
|
||||
class ExceptionHandling(hooks.PecanHook):
|
||||
def on_error(self, state, e):
|
||||
LOG.exception('Pecan state %s', state)
|
||||
|
||||
|
||||
# class StorageHook(hooks.PecanHook):
|
||||
# def __init__(self):
|
||||
# super(StorageHook, self).__init__()
|
||||
# self.storage = storage.get_storage()
|
||||
#
|
||||
# def before(self, state):
|
||||
# state.request.storage = self.storage
|
||||
|
||||
|
||||
class PluginsHook(hooks.PecanHook):
|
||||
PLUGINS_NAMESPACE = 'plugins'
|
||||
|
||||
def __init__(self):
|
||||
super(PluginsHook, self).__init__()
|
||||
self.plugin_manager = extension.ExtensionManager(
|
||||
self.PLUGINS_NAMESPACE, invoke_on_load=True)
|
||||
|
||||
def before(self, state):
|
||||
state.request.plugin_manager = self.plugin_manager
|
||||
LOG.exception('Pecan state %r', state)
|
||||
|
||||
|
||||
class SessionHook(hooks.PecanHook):
|
||||
|
|
Loading…
Reference in New Issue