fixes for tests and fabfiles
This commit is contained in:
parent
e30e14d2e1
commit
9792d1e312
|
@ -22,14 +22,18 @@ def devlink():
|
|||
local('python setup.py develop')
|
||||
|
||||
|
||||
def start_server():
|
||||
def testdeps():
|
||||
local('pip install -r test-requires')
|
||||
|
||||
|
||||
def startserver():
|
||||
local(('ostf-server '
|
||||
'--dbpath postgresql+psycopg2://ostf:ostf@localhost/ostf'
|
||||
'--debug --debug_tests=fuel_plugin/tests/functional/dummy_tests').format(path))
|
||||
'--debug --debug_tests=fuel_plugin/tests/functional/dummy_tests'))
|
||||
|
||||
|
||||
def migrate():
|
||||
path='postgresql+psycopg2://ostf:ostf@localhost/ostf'
|
||||
def migrate(database='ostf'):
|
||||
path='postgresql+psycopg2://ostf:ostf@localhost/{0}'.format(database)
|
||||
local('ostf-server --after-initialization-environment-hook --dbpath {0}'.format(path))
|
||||
|
||||
|
||||
|
@ -44,7 +48,20 @@ def auth(method='trust'):
|
|||
local("sudo service postgresql restart")
|
||||
|
||||
|
||||
def remakedb():
|
||||
dropdb()
|
||||
createdb()
|
||||
migrate()
|
||||
def remakedb(database='ostf'):
|
||||
dropdb(database=database)
|
||||
createdb(database=database)
|
||||
migrate(database=database)
|
||||
|
||||
|
||||
def installapp():
|
||||
deps()
|
||||
devlink()
|
||||
|
||||
|
||||
def integration():
|
||||
local('nosetests fuel_plugin/tests/functional/tests.py:AdapterTests -v')
|
||||
|
||||
|
||||
def unit():
|
||||
local('nosetests fuel_plugin/tests/unit -v')
|
||||
|
|
|
@ -46,10 +46,10 @@ def main():
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
root = app.setup_app(config=config)
|
||||
nose_discovery.discovery(cli_args.debug_tests)
|
||||
|
||||
if getattr(cli_args, 'after_init_hook'):
|
||||
return nailgun_hooks.after_initialization_environment_hook()
|
||||
|
||||
nose_discovery.discovery(cli_args.debug_tests)
|
||||
host, port = pecan.conf.server.host, pecan.conf.server.port
|
||||
srv = pywsgi.WSGIServer((host, int(port)), root)
|
||||
|
||||
|
|
|
@ -81,9 +81,9 @@ def discovery(path=None):
|
|||
function to automaticly discover any test packages
|
||||
"""
|
||||
|
||||
tests = [CORE_PATH, path] if path else [CORE_PATH]
|
||||
tests = path if path else CORE_PATH
|
||||
LOG.info('Starting discovery for %r.', tests)
|
||||
nose_test_runner.SilentTestProgram(
|
||||
addplugins=[DiscoveryPlugin()],
|
||||
exit=False,
|
||||
argv=['tests_discovery', '--collect-only'] + tests)
|
||||
argv=['tests_discovery', '--collect-only', path] )
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
__profile__ = {
|
||||
"id": "stopped_test",
|
||||
"driver": "nose",
|
||||
"test_path": "fuel_plugin/tests/functional/dummy_tests/stopped_test.py",
|
||||
"test_path": "fuel_plugin.tests.functional.dummy_tests.stopped_test.py",
|
||||
"description": "Long running 25 secs fake tests"
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class AdapterTests(BaseAdapterTest):
|
|||
'description': """ This is a simple always pass test
|
||||
""",},
|
||||
{'id': 'long_pass', 'status': 'running'},
|
||||
{'id': 'fail_step', 'message': 'MEssaasasas', 'status': 'failure'},
|
||||
{'id': 'fail_step', 'message': 'Fake fail message', 'status': 'failure'},
|
||||
{'id': 'fast_error', 'message': '', 'status': 'error'},
|
||||
{'id': 'fast_fail', 'message': 'Something goes wroooong', 'status': 'failure'}]}])
|
||||
|
||||
|
@ -215,7 +215,7 @@ class AdapterTests(BaseAdapterTest):
|
|||
testset = "general_test"
|
||||
tests = ['fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_pass',
|
||||
'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_fail']
|
||||
disabled_test = ['functional.dummy_tests.general_test.Dummy_test.test_fast_error', ]
|
||||
disabled_test = ['fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_error', ]
|
||||
cluster_id = 70
|
||||
|
||||
self.client.run_with_timeout(testset, tests, cluster_id, 70)
|
||||
|
@ -230,7 +230,6 @@ class AdapterTests(BaseAdapterTest):
|
|||
{'status': 'failure', 'id': 'fast_fail'},
|
||||
{'status': 'success', 'id': 'fast_pass'},
|
||||
{'status': 'disabled', 'id': 'long_pass'}]}])
|
||||
print r
|
||||
self.compare(r, assertions)
|
||||
time.sleep(5)
|
||||
|
||||
|
|
|
@ -23,13 +23,13 @@ from fuel_plugin.ostf_adapter.storage import models
|
|||
stopped__profile__ = {
|
||||
"id": "stopped_test",
|
||||
"driver": "nose",
|
||||
"test_path": "functional/dummy_tests/stopped_test.py",
|
||||
"test_path": "fuel_plugin/tests/functional/dummy_tests/stopped_test.py",
|
||||
"description": "Long running 25 secs fake tests"
|
||||
}
|
||||
general__profile__ = {
|
||||
"id": "general_test",
|
||||
"driver": "nose",
|
||||
"test_path": "functional/dummy_tests/general_test.py",
|
||||
"test_path": "fuel_plugin/tests/functional/dummy_tests/general_test.py",
|
||||
"description": "General fake tests"
|
||||
}
|
||||
|
||||
|
@ -45,5 +45,5 @@ class TestNoseDiscovery(unittest2.TestCase):
|
|||
def test_discovery(self, engine):
|
||||
engine.get_session().merge.return_value = \
|
||||
lambda *args, **kwargs: self.fixtures_iter.next()
|
||||
nose_discovery.discovery(path='functional/dummy_tests')
|
||||
nose_discovery.discovery(path='fuel_plugin/tests/functional/dummy_tests')
|
||||
self.assertEqual(engine.get_session().merge.call_count, 2)
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
WebTest==2.0.6
|
||||
mock==1.0.1
|
||||
pep8==1.4.6
|
||||
py==1.4.15
|
||||
six==1.3.0
|
||||
six<=1.3.0
|
||||
tox==1.5.0
|
||||
unittest2==0.5.1
|
||||
coverage==3.6
|
||||
requests==1.2.3
|
Loading…
Reference in New Issue