mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
initialize replica set for tests
This commit is contained in:
parent
7f05974f0f
commit
8926178e52
@ -136,11 +136,18 @@ def _configure_bigchaindb(request):
|
||||
def _setup_database(_configure_bigchaindb):
|
||||
from bigchaindb import config
|
||||
from bigchaindb.backend import connect, schema
|
||||
from bigchaindb.backend.mongodb.schema import initialize_replica_set
|
||||
from bigchaindb.common.exceptions import DatabaseDoesNotExist
|
||||
print('Initializing test db')
|
||||
dbname = config['database']['name']
|
||||
conn = connect()
|
||||
|
||||
# if we are setting up mongodb for the first time we need to make sure
|
||||
# that the replica set is initialized before doing any operation in the
|
||||
# database
|
||||
if config['database']['backend'] == 'mongodb':
|
||||
initialize_replica_set(conn)
|
||||
|
||||
try:
|
||||
schema.drop_database(conn, dbname)
|
||||
except DatabaseDoesNotExist:
|
||||
|
Loading…
x
Reference in New Issue
Block a user