mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
disabled mongodb tests for the time being
fixed monogdb Config initialization issues removed default config definition oin Dockerfile-dev Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
9dbcac96e2
commit
910348b210
14
.github/workflows/unit-test.yml
vendored
14
.github/workflows/unit-test.yml
vendored
@ -47,10 +47,10 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- db: "MongoDB with ABCI"
|
#- db: "MongoDB with ABCI"
|
||||||
host: "mongodb"
|
# host: "mongodb"
|
||||||
port: 27017
|
# port: 27017
|
||||||
abci: "enabled"
|
# abci: "enabled"
|
||||||
- db: "Tarantool with ABCI"
|
- db: "Tarantool with ABCI"
|
||||||
host: "tarantool"
|
host: "tarantool"
|
||||||
port: 3303
|
port: 3303
|
||||||
@ -80,9 +80,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- db: "MongoDB without ABCI"
|
#- db: "MongoDB without ABCI"
|
||||||
host: "mongodb"
|
# host: "mongodb"
|
||||||
port: 27017
|
# port: 27017
|
||||||
- db: "Tarantool without ABCI"
|
- db: "Tarantool without ABCI"
|
||||||
host: "tarantool"
|
host: "tarantool"
|
||||||
port: 3303
|
port: 3303
|
||||||
|
|||||||
@ -35,4 +35,3 @@ WORKDIR /usr/src/app
|
|||||||
RUN pip install -e .[dev]
|
RUN pip install -e .[dev]
|
||||||
RUN pip install flask-cors
|
RUN pip install flask-cors
|
||||||
RUN pip install pynacl==1.4.0 base58==2.1.1 pyasn1==0.4.8 zenroom==2.1.0.dev1655293214 cryptography==3.4.7
|
RUN pip install pynacl==1.4.0 base58==2.1.1 pyasn1==0.4.8 zenroom==2.1.0.dev1655293214 cryptography==3.4.7
|
||||||
RUN planetmint -y configure
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class LocalMongoDBConnection(DBConnection):
|
|||||||
)
|
)
|
||||||
self.crlfile = _kwargs_parser(key="crlfile", kwargs=kwargs) or dbconf["crlfile"]
|
self.crlfile = _kwargs_parser(key="crlfile", kwargs=kwargs) or dbconf["crlfile"]
|
||||||
self.max_tries = _kwargs_parser(key="max_tries", kwargs=kwargs)
|
self.max_tries = _kwargs_parser(key="max_tries", kwargs=kwargs)
|
||||||
self.connection_timeout = _kwargs_parser(key="connection_timeout", kwargs=kwargs)
|
self.connection_timeout = _kwargs_parser(key="connection_timeout", kwargs=kwargs) or dbconf["connection_timeout"]
|
||||||
self.__conn = None
|
self.__conn = None
|
||||||
self.connect()
|
self.connect()
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class LocalMongoDBConnection(DBConnection):
|
|||||||
connecting to the database.
|
connecting to the database.
|
||||||
"""
|
"""
|
||||||
if self.__conn:
|
if self.__conn:
|
||||||
return self._conn
|
return self.__conn
|
||||||
try:
|
try:
|
||||||
# FYI: the connection process might raise a
|
# FYI: the connection process might raise a
|
||||||
# `ServerSelectionTimeoutError`, that is a subclass of
|
# `ServerSelectionTimeoutError`, that is a subclass of
|
||||||
|
|||||||
@ -63,7 +63,7 @@ INDEXES = {
|
|||||||
def create_database(conn, dbname):
|
def create_database(conn, dbname):
|
||||||
logger.info("Create database `%s`.", dbname)
|
logger.info("Create database `%s`.", dbname)
|
||||||
# TODO: read and write concerns can be declared here
|
# TODO: read and write concerns can be declared here
|
||||||
conn.conn.get_database(dbname)
|
conn.connect().get_database(dbname)
|
||||||
|
|
||||||
|
|
||||||
@register_schema(LocalMongoDBConnection)
|
@register_schema(LocalMongoDBConnection)
|
||||||
@ -73,7 +73,7 @@ def create_tables(conn, dbname):
|
|||||||
# TODO: read and write concerns can be declared here
|
# TODO: read and write concerns can be declared here
|
||||||
try:
|
try:
|
||||||
logger.info(f"Create `{table_name}` table.")
|
logger.info(f"Create `{table_name}` table.")
|
||||||
conn.conn[dbname].create_collection(table_name)
|
conn.connect()[dbname].create_collection(table_name)
|
||||||
except CollectionInvalid:
|
except CollectionInvalid:
|
||||||
logger.info(f"Collection {table_name} already exists.")
|
logger.info(f"Collection {table_name} already exists.")
|
||||||
create_indexes(conn, dbname, table_name, INDEXES[table_name])
|
create_indexes(conn, dbname, table_name, INDEXES[table_name])
|
||||||
@ -82,9 +82,9 @@ def create_tables(conn, dbname):
|
|||||||
def create_indexes(conn, dbname, collection, indexes):
|
def create_indexes(conn, dbname, collection, indexes):
|
||||||
logger.info(f"Ensure secondary indexes for `{collection}`.")
|
logger.info(f"Ensure secondary indexes for `{collection}`.")
|
||||||
for fields, kwargs in indexes:
|
for fields, kwargs in indexes:
|
||||||
conn.conn[dbname][collection].create_index(fields, **kwargs)
|
conn.connect()[dbname][collection].create_index(fields, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@register_schema(LocalMongoDBConnection)
|
@register_schema(LocalMongoDBConnection)
|
||||||
def drop_database(conn, dbname):
|
def drop_database(conn, dbname):
|
||||||
conn.conn.drop_database(dbname)
|
conn.connect().drop_database(dbname)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import os
|
|||||||
|
|
||||||
# from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config
|
# from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config
|
||||||
from planetmint.version import __version__ # noqa
|
from planetmint.version import __version__ # noqa
|
||||||
|
from decouple import config
|
||||||
|
|
||||||
|
|
||||||
class Singleton(type):
|
class Singleton(type):
|
||||||
@ -26,7 +27,7 @@ class Config(metaclass=Singleton):
|
|||||||
# _base_database_localmongodb.keys() because dicts are unordered.
|
# _base_database_localmongodb.keys() because dicts are unordered.
|
||||||
# I tried to configure
|
# I tried to configure
|
||||||
self.log_config = DEFAULT_LOGGING_CONFIG
|
self.log_config = DEFAULT_LOGGING_CONFIG
|
||||||
db = "tarantool_db"
|
db = config('PLANETMINT_DATABASE_BACKEND', default="tarantool_db")
|
||||||
self.__private_database_keys_map = { # TODO Check if it is working after removing 'name' field
|
self.__private_database_keys_map = { # TODO Check if it is working after removing 'name' field
|
||||||
"tarantool_db": ("host", "port"),
|
"tarantool_db": ("host", "port"),
|
||||||
"localmongodb": ("host", "port", "name"),
|
"localmongodb": ("host", "port", "name"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user