Commit 21eec6b3 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[tests][databases] Index databases before running tests using them

parent 2ea880e3
......@@ -31,11 +31,16 @@
import nose.tools
from . import platform, disconnected, prefix, tmp_prefix, user, token
from ..scripts.beat import main
from beat.core.test.utils import slow, cleanup, skipif
from beat.core.database import Storage, Database
def index_integer_db():
call('index', 'integers_db/1')
def call(*args, **kwargs):
'''A central mechanism to call the main routine with the right parameters'''
......@@ -106,22 +111,28 @@ def test_status():
nose.tools.eq_(call('status', prefix=tmp_prefix), 0)
@nose.tools.with_setup(setup=index_integer_db, teardown=cleanup)
def test_view_good():
nose.tools.eq_(call('view', 'integers_db/1/double/double'), 0)
@nose.tools.with_setup(setup=index_integer_db, teardown=cleanup)
def test_view_unknown_protocol():
nose.tools.eq_(call('view', 'integers_db/1/single/double'), 1)
@nose.tools.with_setup(setup=index_integer_db, teardown=cleanup)
def test_view_unknown_set():
nose.tools.eq_(call('view', 'integers_db/1/double/single'), 1)
@nose.tools.with_setup(setup=index_integer_db, teardown=cleanup)
def test_view_bad():
nose.tools.eq_(call('view', 'integers_db/1/two_sets'), 1)
@nose.tools.with_setup(setup=index_integer_db, teardown=cleanup)
def test_view_invalid():
nose.tools.eq_(call('view', 'invalid/1/default/set'), 1)
......@@ -141,12 +152,6 @@ def test_list_index_good():
nose.tools.eq_(call('index', '--list', 'integers_db/1'), 0)
@nose.tools.with_setup(teardown=cleanup)
def test_checksum_index_good():
nose.tools.eq_(call('index', 'integers_db/1'), 0)
nose.tools.eq_(call('index', '--checksum', 'integers_db/1'), 0)
@nose.tools.with_setup(teardown=cleanup)
def test_delete_index_good():
nose.tools.eq_(call('index', 'integers_db/1'), 0)
......@@ -155,7 +160,7 @@ def test_delete_index_good():
@nose.tools.with_setup(teardown=cleanup)
def test_index_all(): #bad and good, return != 0
expected_errors = 19
expected_errors = 16
existing_errors = call('index')
assert existing_errors >= expected_errors, "There should be at least %d " \
"errors on installed databases, but I've found only %d" % \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment