def es_connection(es): """ """ host, port = es conn_str = "es://@{0}:{1}/".format(host, port) conn = create_connection(conn_str, "elasticsearch.Elasticsearch") assert conn.raw_connection.ping() yield conn
def init_fhirbase_pg(fhirbase_pg): """ """ host, port = fhirbase_pg conn_str = "pg://postgres:@{0}:{1}/fhir_db".format(host, port) connection = create_connection(conn_str) _init_fhirbase_structure(connection) yield connection
def test_pg_connection_creation(fhirbase_pg): """ """ host, port = fhirbase_pg conn_str = "pg://postgres:@{0}:{1}/fhir_db".format(host, port) connection = create_connection(conn_str) info = connection.server_info() assert info is not None
async def async_es_connection(es): """ """ host, port = es conn_str = "es://@{0}:{1}/".format(host, port) conn = create_connection(conn_str, "elasticsearch.AsyncElasticsearch") assert await conn.raw_connection.ping() yield conn await conn.raw_connection.close()
def test_es_connection_creation(es): """ """ host, port = es conn_str = "es://@{0}:{1}/".format(host, port) conn = create_connection(conn_str, Elasticsearch) assert conn.raw_connection.ping() is True conn = ES.ElasticsearchConnection.from_url(conn_str) assert conn.raw_connection.ping() is True
async def test_async_es_connection_creation(es): """ """ host, port = es conn_str = "es://@{0}:{1}/".format(host, port) conn = create_connection(conn_str, "elasticsearch.AsyncElasticsearch") assert isinstance(conn.raw_connection, AsyncElasticsearch) assert await conn.raw_connection.ping() is True conn = ES.AsyncElasticsearchConnection.from_url(conn_str) assert isinstance(conn.raw_connection, AsyncElasticsearch) assert await conn.raw_connection.ping() is True